Jump to content

Recommended Posts

SELECT *
FROM `posts`
WHERE `ID` = '$users_ID'
LIMIT 0 , 30

or

SELECT *
FROM posts
WHERE ID = '$users_ID'
LIMIT 0 , 30

 

I have been using the second example of above, I don't bother with the back-ticks. However, I was wondering, do they actually speed up the queries?

 

Joe

I don't know if there is a speed implication but there is a security one.

 

Supposedly backticks protect against SQL injection where field names are put in by the user (which is rare for - a CMS or PHPMyAdmin need them but I don't go that far with my sites).  I must admit I leave them out and hope I will remember to add them if ever the user inputs field names with POST or GET.

 

I did once find myself accidentally using a reserved word as a field name which meant I had to use them as thorpe says but I then changed the field name which seemed a better solution.

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.