Older version of MySQL does not support subselects.
On Sun, August 20, 2006 5:18 am, Bigmark wrote:
> Can anyone tell me why this works on my localhost but gets an error on
> my
> server:
>
> $sql = "SELECT COUNT(*) FROM leaderboard WHERE points >=( SELECT
> points FROM
> leaderboard WHERE user
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:[EMAIL PROTECTED]
Sent: Sunday, August 20, 2006 5:19 PM
To: php-general@
On 8/20/06, Bigmark <[EMAIL PROTECTED]> wrote:
Can anyone tell me why this works on my localhost but gets an error on my
server:
=( SELECT points FROM
leaderboard WHERE username= '$username' )";
$result = mysql_query( $sql ) or die ( mysql_error() );
$rank = mysql_result( $result, 0 );
echo $ran
On Sun, 2006-08-20 at 18:18 +0800, Bigmark wrote:
> Can anyone tell me why this works on my localhost but gets an error on my
> server:
>
Try quote your identifiers.
SELECT COUNT(*) FROM `leaderboard` WHERE `points` >=( SELECT `points`
FROM
`leaderboard` WHERE `username` = '$username' );
--Pau
4 matches
Mail list logo