Re: SQL Quick problem

From: Date: Sat, 02 Dec 2000 22:15:05 +0000
Subject: Re: SQL Quick problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4962@lists.php.net to get a copy of this message
Actually, you're not supposed to use a semicolon at the end of a query. Since PHP uses the MySQL C API, you can find confirmation of this in the MySQL C API documentation. http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#mysql _query section 22.4.40.1, third sentence. I see no reason to expect that putting parentheses around the value he's trying to assign to $query will fix it either. In truth, I see nothing wrong with the statement as it appears. Since the problem is a parse error in the PHP assignemnt statement, I suspect something else that he hasn't shown us. Usually, it's something like: Forgotton semicolon at the end of a previous PHP statement A beginning quotation mark with no ending quotation mark in an earlier statement Mismatched curly braces Mismatched parentheses in an earlier statement But it's impossible to tell, since we weren't given the line that is actually causing the error, but only the line at which PHP discovers a problem (and the line after it). Doug At 07:33 PM 12/2/00 -0200, =?Windows-1252?Q?F=E1bio_Ottolini?= wrote: >$query = ("SELECT name, city FROM clubs;"); > >Try this. You forgot the ";" at the end of the query. > >Best regards, > >Fábio Ottolini > > > ----- Original Message ----- > From: Howard Sanders > To: php-db@lists.php.net > Sent: Saturday, December 02, 2000 7:08 PM > Subject: [PHP-DB] SQL Quick problem > > > Hi > Could someone tell me what is wrong with > $query = "SELECT name, city FROM clubs"; > $result = mysql_query ($query) > or die ("Query failed"); > in a mySQL database query using PHP? > I get a Parse error on the $query..... line > > Many thanks for your help > Howard >

« previous php.db (#4962) next »