I have a comment form like this. -form with 1 field (comments) if user is login or -form with 3 fields (name, email, comment) if user is not login (like visitor)
After user is submitting the comment depending by status (login or not) write inside the comments table the data like this example: - if user is login write com_id_author=3 and keep empty com_author and com_email - if user is NOT login write com_id_author=0 , com_author="Andreas" , com_email="[email protected]"
comments
com_id | com_id_author | com_author (allow NULL) | com_email (allow NULL) | com_content
users
user_id | user_name | user_pass | user_email
My question is:
What is the MYSQL syntax to read: comment id, author id , author name, author email and content