Originally posted by diego25
My guess is that $queryrows is wrong. Maybe it's out of scope or something? Where is it coming from? Did you try doing a print_r on $queryrows?
Diego
This is my entire code. I believe $queryrows is ok, because the FIRST LOOP prints out how it is supposed to. When the loop swings around to go again, I get the error messages that I posted above. It's really weird, but it's also essential for me to figure this problem out, as it's an integral part to what I'm programming.
$query = "select username from user_info";
$result = mysql_query($query);
$queryrows = mysql_fetch_row($result);
$numberofrows = mysql_num_rows($result);
echo "<b>Number of rows from initial query: ".$numberofrows."<br><br></b>";
echo "<b>Value of first result: ".$queryrows[0]."<br><br><b>";
for($i=0; $i<$numberofrows;){
$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++;
}
Note that the errors (lines 23 and 27) are the lines in the code for "$updatequery =" and "$valuequery ="
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
What IS an undefined offset, anyway? I've searched the net all night and I can't find any documentation on this error, anywhere. Just pages where this error has occured.