I am trying to update a table from results generated from a select query, but can't seem to get the queries running right. The select query works fine, but when I try to use the results for an update it error out. Here is my query:
db_connect(); $query = "SELECT cst_SiteID FROM customers WHERE cst_Offer = 1"; echo $query; echo "<br/>"; $result = mysql_query($query); $numofrows = mysql_num_rows($result); $numofcols = mysql_num_fields($result); echo "<table>\n"; for ( $r = 0; $r < $numofrows; $r++) { $row = mysql_fetch_array($result); echo "<td>$row[0]</td>"; $updatequery = "UPDATE assets " . "SET asset_Managed = '2' " . "WHERE asset_SiteID = $row[0]"; $result = mysql_query($updatequery) or die ("Query Failed: $updatequery"); $numofrows = mysql_num_rows($result); for ($i = 0; $i < $numofrows; $i++) { $row = mysql_fetch_array($result); echo "<td>$row[0]</td>"; } } I just want to use the result from the first query as input to my update query. Any ideas what I am doing wrong? Sincerely, Chris Dietzler AT&T Enhanced Network Services 858 812 4062 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]