re: multiple queries in PHP ????

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux