Greetings,
Is there anything functionally wrong with this code? There must be, 'cuz I keep getting errors:
for($i=0; $i<$numberofrows; $i++){
$updatequery = "update ".$queryrows[$i]." set value = 5";
$updateresult = mysql_query($updatequery);
$valuequery = "select gangname, value from ".$queryrows[$i];
$valueresult = mysql_query($valuequery);
$valuerows = mysql_fetch_array($valueresult);
echo "<b>Number of rows returned after update: ".$valuerows."<br><br></b>";
echo "<b>Value of first result: ".$valuerows[0]."<br><br></b>";
echo "\$i= ".$i."<br><br>";
}
I want to run an updating mysql query from an array of tables.
When I run this code, it seems that the first loop goes ok, then I get this error message:
Notice: Undefined offset: 1 in C:\Program Files\Apache Group\Apache2\htdocs\Test Stuff\individualtabletest.php on line 23
Notice: Undefined offset: 1 in C:\Program Files\Apache Group\Apache2\htdocs\Test Stuff\individualtabletest.php on line 27
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\Test Stuff\individualtabletest.php on line 29
Number of rows returned after update:
Value of first result:
$i= 1