Hi all,
I am iterating through a result set to generate a second set of queries but
no matter what I do I get the error
Warning: mysql_num_rows( ): supplied argument is not a valid MySQL result
resource
even though if I echo the query to the browser and cut and paste it into the
command line I get valid results.
Do I have to store the first result in an array before doing the second set?
TIA,
jg
while ($i < mysql_num_rows( $result)) {
$PIDs[$id]['ClientName'] = $client;
$PIDs[$id]['ProjectName'] = mysql_result($r esult, $i, 'Name');
$PIDs[$id]['PID'] = mysql_result($r esult, $i, 'PID');
$thisPID = $PIDs[$id]['PID'];
$PIDresult = ("SELECT * from hours WHERE PID = '$thisPID'") or
die(mysql_error ());
$j=0;
while ($j < mysql_num_rows( $PIDresult)) {
$PIDs[$id]['PID']['Comments'] = mysql_result($P IDresult, $j,
'Comments');
$j++;
}
$i++;
}
}
I am iterating through a result set to generate a second set of queries but
no matter what I do I get the error
Warning: mysql_num_rows( ): supplied argument is not a valid MySQL result
resource
even though if I echo the query to the browser and cut and paste it into the
command line I get valid results.
Do I have to store the first result in an array before doing the second set?
TIA,
jg
while ($i < mysql_num_rows( $result)) {
$PIDs[$id]['ClientName'] = $client;
$PIDs[$id]['ProjectName'] = mysql_result($r esult, $i, 'Name');
$PIDs[$id]['PID'] = mysql_result($r esult, $i, 'PID');
$thisPID = $PIDs[$id]['PID'];
$PIDresult = ("SELECT * from hours WHERE PID = '$thisPID'") or
die(mysql_error ());
$j=0;
while ($j < mysql_num_rows( $PIDresult)) {
$PIDs[$id]['PID']['Comments'] = mysql_result($P IDresult, $j,
'Comments');
$j++;
}
$i++;
}
}
Comment