Mysql Syntax |
For a list of all requirements and guidelines pertaining to posting a new Help topic, please click here.
This Month's Contests | Staff Member of the Month | Hosts Looking for Hostees | Hostees looking for Hosts | BigBookofResources
Submission Guidelines
Mysql Syntax |
Feb 27 2011, 10:57 AM
Post
#1
|
|
Senior Member Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 |
This code doesn't work.
CODE SELECT * FROM 'bookmarks' WHERE 'group' = 'Social' This code does. CODE SELECT * FROM `bookmarks` WHERE `group` = 'Social' The working code was generated by phpmyadmin. I've seen those diagonal single quote marks, nor have I read anything about them in php books/tutorials/etc. What are they, and how do I even make them? I feel stupid asking this but I just spent an hour trying to figure out why my sql query wasn't working and that appears to be the only difference. |
|
|
Feb 27 2011, 05:54 PM
Post
#2
|
|
Senior Member Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 |
Single quotes denote a string. Table and column names are not strings, thus you can't use single quotes. However, some databases allow you to use backticks (`) around table and column names. Personally, I never use backticks around table/column names.
|
|
|
Feb 28 2011, 12:39 AM
Post
#3
|
|
Senior Member Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 |
Single quotes denote a string. Table and column names are not strings, thus you can't use single quotes. However, some databases allow you to use backticks (`) around table and column names. Personally, I never use backticks around table/column names. Oh, so I could have just been using: CODE SELECT * FROM bookmarks WHERE group = 'Social' That makes sense, thanks Michael. |
|
|