Jump to content

multiple $query and $result on the same page


webguync

Recommended Posts

is it ok to use multiple $query and $result for different SQL statements?

 

for example:

 

$query = "SELECT username,pwid,name,user_id
           FROM   roster
           WHERE
           pwid = '$pwid'
           AND
           username='$username'";

   $result = mysql_query($query) or die(mysql_error());

 

and further down the page...

$query = "UPDATE roster
          SET login_timestamp = DATE_ADD(NOW(), INTERVAL 3 HOUR)
          WHERE username = '$username'
           AND pwid = '$pwid' ";
//echo $query; //for debugging test 
$result = mysql_query($query) or die(mysql_error()); 

 

 

...even further down the page


$query = "DELETE FROM log WHERE user_id = $user_id AND roster.user_id = $user_id";
//echo $query; //for debugging test 
$result = mysql_query($query) or die(mysql_error()); 

 

or would I need to change to $query1,$result1,$query2,$result2,$query3,$result3?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.