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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.