Jump to content

SQL syntax error to check manual


bbram

Recommended Posts

Hello I have the following error:

 

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 'FROM players WHERE ((NOT inactive_player) AND ((players.Player_Last_Name = 'p' at line 3

 

I think my error is in the statement below...

 

 

echo "1";
$getNewPlayers = 
"SELECT players.Player_number, 
	players.Player_name, 
FROM players
WHERE ((NOT inactive_player)
AND ((players.Player_Last_Name = 'player_find%')))
ORDER BY player_name";
$rsNewPlayers = mysql_query($getNewPlayers, $link) or die (mysql_error());
$varNewCount = mysql_num_rows($rsNewPlayers);
echo $varNewCount['Player_name'];

 

Can you tell me where the error is and how I might go about to fix it?

 

Thanks,

 

Link to comment
Share on other sites

Okay I got it fixed thanks for your help...

 

Now my query is not displaying any information...

 

$countPlayers=mysql_query("SELECT players.Player_number, 
	players.Player_name 
FROM players
WHERE ((NOT Inactive_player)
AND ((players.Player_Last_Name = '$player_find%')))
ORDER BY Player_name");

$row = mysql_fetch_assoc($countPlayers) or die("No rows returned by query"); 
echo $row['Player_number'];

Link to comment
Share on other sites

if you want to mach just start of last name try

$countPlayers=mysql_query("SELECT players.Player_number, 
	players.Player_name 
FROM players
WHERE ((NOT Inactive_player)
AND (players.Player_Last_Name LIKE '$player_find%'))
ORDER BY Player_name");

or if you want to mach hole last name

$countPlayers=mysql_query("SELECT players.Player_number, 
	players.Player_name 
FROM players
WHERE ((NOT Inactive_player)
AND ((players.Player_Last_Name = '$player_find')))
ORDER BY Player_name");

$row = mysql_fetch_assoc($countPlayers) or die("No rows returned by query"); 
echo $row['Player_number'];

 

$row = mysql_fetch_assoc($countPlayers) or die("No rows returned by query");

echo $row['Player_number'];[/code]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.