RE: Help?

From: Date: Mon, 31 Jul 2000 19:35:32 +0000
Subject: RE: Help?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9257@lists.php.net to get a copy of this message
On 31-Jul-00 Wee Chua wrote: > Hi everyone, > I have a field on the form in HTML which is a Selection with 2 options. > There are Company and Employee. For example, > Select one: <Select Name="Game"> > <option value"Emp">Employee</option> > <option value"Comp">Company</option> > </Select> > > Now, I want to use the selection on the form in order to retrieve the data > from such table in php. Assuming I have all the host, username and password > are correct and connected, I also have chosen the database I want to run > with. Here is the SQL statement with php. $result is a variable. > > $result = mysql_query("Select * from $Game",$db); > > I don't know how to pass the value from the <Select> to implement this SQL > statement. I also gave me the error message " Supplied argument is not a > valid MySQL result". > > Could anyone tell me how to pass the value from <Select> into SQL statement > with php. Thanks! add a bit of debuging ? if (! isset($db)) echo "No db connection<BR>"; if (! isset($Game)) echo "No Game<BR>"; else echo "using ".$Game."<BR>"; $result = mysql_query("Select * from $Game",$db) or die(mysql_error()); while ($row=mysql_fetch_result($result)) { var_dump($row); echo "<P>"; } Regards, -- Don Read dread@texas.net -- "Stop telling God what to do" - Niels Bohr to A. Einstein

« previous php.general (#9257) next »