$sql = "UPDATE table SET field1= '$field1', field2= '$field2', WHERE id= '$id'";
$sql2 = "UPDATE table2 SET field3= '$field3', field4= '$field4', WHERE newid = '$newid'";
I want the query to enter both into the tables and after the second query use:
header ('Location: yfile.php');
But not sure of the placement and the deal with echo's. I think I can't echo anything if I want to use a header, later. Where do I put the header?
Also, in the following code, where in the <select name> it says value1, how do I set it so this value is dynamic. There are going to be 20 or so results, each row I want different, in order, starting with 1.
<?
// includes
include("conf.php");
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
$query = "SELECT * FROM players ORDER BY hand_id DESC";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print article titles
while($row = mysql_fetch_object($result))
{
?>
<tr>
<td><? echo $row->lastname; ?> <? echo $row->firstname; ?></td>
<td><select name="value1" size="1">
<option value="0">0</option>
<option value="1">1</option> <option value="2">2</option>
<option value="3">3</option> <option value="4">4</option>
<option value="5">5</option> <option value="6">6</option>
<option value="7">7</option> <option value="8">8</option>
<option value="9">9</option> <option value="10">10</option>
</select></td></tr>
<?
}
}
// if no records present
// display message
else
{
?>
<font size="-1">no players currently available</font>
<?
}
// close database connection
mysql_close($connection);
?>