syntax error help
5 answers - 662 bytes -

Can anyone tell me why this works on my localhost but gets an error on my
server:
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >=( SELECT points FRM
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 FRM leaderboard WHERE username= 'ainslie' )' at
No.1 | | 379 bytes |
| 
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 ****(*) FRM `leaderboard` WHERE `points` >=( SELECT `points`
FRM
`leaderboard` WHERE `username` = '$username' );
All Email originating from UWC is covered by disclaimer
No.2 | | 872 bytes |
| 
8/20/06, Bigmark <neretlis (AT) westnet (DOT) com.auwrote:
Can anyone tell me why this works on my localhost but gets an error on my
server:
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >=( SELECT points FRM
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 FRM leaderboard WHERE username= 'ainslie' )' at
They are different mysql versions.
Your localhost version is 4.1+ which supports sub-selects, the other
one is 4.0 or below.
No.3 | | 1078 bytes |
| 
It works now: I replaced the last part of the sql with a variable
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >= $my_points ";
$result = mysql_query( $sql ) or die ( mysql_error() );
$rank = mysql_result( $result, 0 );
echo $rank;
?>
""Bigmark"" <neretlis (AT) westnet (DOT) com.auwrote in message
news:F7.A0.03273.10738E44 (AT) pb1 (DOT) pair.com
Can anyone tell me why this works on my localhost but gets an error on my
server:
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >=( SELECT points
FRM
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 FRM leaderboard WHERE username= 'ainslie' )' at
No.4 | | 1078 bytes |
| 
It works now: I replaced the last part of the sql with a variable
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >= $my_points ";
$result = mysql_query( $sql ) or die ( mysql_error() );
$rank = mysql_result( $result, 0 );
echo $rank;
?>
""Bigmark"" <neretlis (AT) westnet (DOT) com.auwrote in message
news:F7.A0.03273.10738E44 (AT) pb1 (DOT) pair.com
Can anyone tell me why this works on my localhost but gets an error on my
server:
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >=( SELECT points
FRM
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 FRM leaderboard WHERE username= 'ainslie' )' at
No.5 | | 779 bytes |
| 
version of MySQL does not support subselects.
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:
<?php
$sql = "SELECT ****(*) FRM leaderboard WHERE points >=( SELECT
points FRM
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 FRM leaderboard WHERE username= 'ainslie' )' at