Jump to content

Syntax question


fxuser

Recommended Posts

for example when i want to do a query to mysql i use

mysql_query("INSERT INTO table VALUES('1','2','3')");

or

mysql_query(SELECT * FROM table WHERE column1 = 'text');

 

do i have to put "`" in each table name and after the WHERE in the columns , also do i have to put after table (column1) , parentheses with their columns?

 

i have seen it in some threads but im not sure what this will change on the performance of mysql?

 

my website works just fine without these added so i would to know if i do have to add them or not.

 

thanks.

Link to comment
https://forums.phpfreaks.com/topic/226396-syntax-question/
Share on other sites

do i have to put "`" in each table name and after the WHERE in the columns

 

If your table is really named 'table' then yes, you have to use backticks around it every time since it is a MySQL RESERVED WORD.  You should not be naming your tables OR columns with these words.  If your table is named other than a reserved word then you don't need them, although, some consider it good practice.

 

also do i have to put after table (column1) , parentheses with their columns?

 

Take a look at the manual, it will answer this question:

http://dev.mysql.com/doc/refman/5.5/en/insert.html

Link to comment
https://forums.phpfreaks.com/topic/226396-syntax-question/#findComment-1168530
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.