Reply
Old 11-22-2006, 12:59 PM Re: Question
Ultra Talker

Posts: 484
Trades: 0
Excuse my ignorance, but why will that extra semi colon give you nothing? It's in the string, so it's not affecting the PHP script itself at all and besides, a properly formed MySQL query ends with a semi colon (at http://dev.mysql.com/doc/refman/4.1/...g-queries.html it even says: "Multiple-line statements commonly occur by accident when you intend to issue a command on a single line, but forget the terminating semicolon.").
__________________
Free PHP Obfuscator
TwistMyArm is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 11-22-2006, 06:58 PM Re: Question
Experienced Talker

Posts: 40
Trades: 0
Hope this is not too off topic, since it is important IMO. Problems with ; and ' and " and ` are not new to coders.

Quote:
Originally Posted by ctess View Post
Proper MYSQL Syntax uses backticks to specify the difference between tablenames/rows, etc from variables.
Very important distinction. I am quite new to PHP, so I have never used table names and columns in this way. Great to know in advance.

Quote:
Originally Posted by ctess View Post
I have actually had errors before because I didn't use backticks on some row names because they were the same as a few of my global variables and PHP tried to interpret it funny (I haven't had this problem in php5 only past php versions).
My bolding. Does that mean that the distinction is not important in php5.X? I use php 5.1 on the Danish web server.

Last edited by kgun; 11-22-2006 at 06:59 PM..
kgun is offline
Reply With Quote
View Public Profile
 
Old 11-23-2006, 02:33 AM Re: Question
Super Talker

Posts: 124
Name: Chris
Trades: 0
To answer Kgun first, You should stick to proper formatting with backticks even though it may or may not be used anymore (I will have to look it up, as far as I know the latest version of phpmyadmin still uses backticks with formatting).

The major reason I personally use backticks is to make my query a bit more readable. I have had some trouble before with $_SESSION['id'] and a row named id. Usually when I use the query: SELECT id FROM users WHERE id = '1'; etc etc. It hasn't happened to me recently so it could have been my syntaxing from awhile ago. I just know that I used to get database problems with reading the information.

Twist, You brought up a good point. mysql formatting does allow the semicolon I had forgotten that. However since he isn't executing it from the mysql command line it may be translated differently since in PHP reads semicolons as endlines unless they are escaped. semicolons are one of those characters that fall under the special chracters column so it may have to be syntaxed as: \;

I will check it just for the hell of it.


------EDIT-------

Twist is correct it does still work with the semicolon. I was wrong to assume php would interpret it as an endline chracter. However usually when using a semicolon it is for multiline purposes
__________________
Chris - Trying to help others and learn myself!
http://www.nvision-media.com

Last edited by ctess; 11-23-2006 at 02:43 AM..
ctess is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11690 seconds with 12 queries