I don't know what this error meas as I just started working with databases and MySQL. The warning is this:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\surveyresults.php on line 57
And the code is this:
function update_database($newdata)
{
$connection = mysql_connect("localhost","root");
mysql_select_db("teachersurvey", $connection);
for ($rownumber=1; $rownumber<=6; $rownumber++)
{
$myquery= "SELECT * FROM teacher where pid=".$rownumber;
$result = mysql_query ($myquery, $connection); //this is line 57
$row = mysql_fetch_array($result); # grab one row of the table
for ($j=1; $j<=4; $j++)
{
$scorehandle="score".$j;
$count[$j]=$row[$scorehandle];
debug("in row $rownumber, score $j was:".$count[$j]);
}
# Now, increment the count, based on the current product's results\
$score=$newdata[$rownumber];
if ($score>=1 && $score<=4) # Safety check
{
$count[$score]++;
debug("score=$score, count= ".$count[$score]);
# Now, write that row information back into the database
$putquery="UPDATE teacher SET score".$score." = ".
$count[$score]." where pid=".$rownumber;
debug("the put query:".$putquery);
$result= mysql_query ($putquery, $connection);
}
Thank you in advance