Simple MySQL Query Syntax Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sirstrumalot
Forum Commoner
Posts: 27
Joined: Mon May 18, 2009 10:26 pm

Simple MySQL Query Syntax Issue

Post by sirstrumalot »

I'm trying to set this but I must be messing up the syntax on the variable ($row_userinfo['user_ProviderName']) Any ideas?

The message I get is:

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 '' at line 1

Code: Select all

mysql_select_db($database_contacts, $missed_visits);
$query_missed_visits = "SELECT * FROM missedVisit WHERE missed_provider = ".$row_userinfo['user_providerName']." $sorder";
$missed_visits = mysql_query($query_missed_visits, $missed_visits) or die(mysql_error());
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Simple MySQL Query Syntax Issue

Post by jaoudestudios »

Whats in $sorder?

Show us the final query (after php) and we can adjust it as required, then you can play with php to auto gen it
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Simple MySQL Query Syntax Issue

Post by Eran »

user_providerName is probably a string and needs to be quoted
Post Reply