Re: Select string from MySQL db

From: Date: Mon, 02 Oct 2000 02:06:05 +0000
Subject: Re: Select string from MySQL db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18235@lists.php.net to get a copy of this message
On Sun, 1 Oct 2000 17:30:46 -0700, PHP List (phplist@webbcite.com) wrote: >I am trying to match a text string from a MySQL table to pull >information. >Is there a way to do this? > >Here is my code: > >$sql = "SELECT * > FROM weeklyLineups > WHERE week=$week > AND ownerID=$ownerID > AND playerName=$playerName this should be AND playerName='$playerName' > "; >$sql_result = mysql_query($sql,$connection) or die (" Couldn't >execute >query."); heres a tip - change to: $sql_result = mysql_query($sql,$connection) or die(mysql_error()); that way you can see what went wrong while debugging. - Mark >while ($row = mysql_fetch_array($sql_result)) { > $weeklyID= $row["weeklyID"]; >echo " > $weeklyID<br> >"; >} > > >$week and $ownerID are numbers. $playerName is a text string like - >John >Doe. I receive the error "Couldn't execute query". It must be the >string >that is messing things up. > >I am a newbie and would love some help trying to get this figured >out. I >have been playing with it for over a week. > >Thanks, >Scott > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list- >admin@lists.php.net

« previous php.general (#18235) next »