echo $updatequery to screen and see what the sql looks like.
> 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>"; > } > } > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]