RE: syntax error help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check the version of MySQL, I think sub queries came in version 4.1 and you
are using that. So you probably have a version>=4.1 at localhost, and <4.1
at your server.

/Peter


-----Original Message-----
From: Bigmark [mailto:neretlis@xxxxxxxxxxxxxx] 
Sent: Sunday, August 20, 2006 5:19 PM
To: php-general@xxxxxxxxxxxxx
Subject:  syntax error help

Can anyone tell me why this works on my localhost but gets an error on my
server:

<?php
$sql = "SELECT COUNT(*) FROM leaderboard WHERE points >=( SELECT points FROM
leaderboard WHERE username= '$username' )";
$result = mysql_query( $sql ) or die ( mysql_error() );
$rank = mysql_result( $result, 0 );
echo $rank;
?>


this is the error message but i cant figure it out:

Your Position  You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
'SELECT points FROM leaderboard WHERE username= 'ainslie' )' at

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux