re: multiple queries in PHP ????

From: Date: Wed, 26 Mar 2003 08:41:32 +0000
Subject: re: multiple queries in PHP ????
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-26626@lists.php.net to get a copy of this message
Hi, This is what I have so far. <? if ($REQUEST_METHOD == "POST") { $usr = "usr"; $pwd = "pwd"; $db = "db"; $host = "localhost"; $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db); // NOTE that form fields automatically become variables $sql = "UPDATE round1 SET score=score+1 WHERE $select='$winner'"; mysql_query("$sql"); echo("Points credited? I hope!<br><br>"); } else {echo("An error occoured, please click back button and try again.");} ?> Now is this right? <? if ($REQUEST_METHOD == "POST") { $usr = "usr"; $pwd = "pwd"; $db = "db"; $host = "localhost"; $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db); // NOTE that form fields automatically become variables $sql = "UPDATE round1 SET score=score+1 WHERE $select='$winner'"; if (match) { $sql = "UPDATE round1 SET score=score+1 WHERE $select='$winner': $sql = "UPDATE profile SET update_table2; } mysql_query("$sql"); echo("Points credited? I hope!<br><br>"); } else {echo("An error occoured, please click back button and try again.");} ?> http://mobile.yahoo.com.au - Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile.

« previous php.db (#26626) next »