wolfas Posted September 5, 2006 Share Posted September 5, 2006 Hi,when i use only "while{}" my script works but when i add a "for{}" in "while{}" i get a following error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/index.php on line 57 here is the code :while ($row = mysql_fetch_array($r))//line 57 { echo "$row[ivykis] $row[form]"; if ($row['form']==1) {$f++; echo "Taip <input type=\"radio\" name=\"radio$f\" value=\"taip\"> Ne <input type=\"radio\" name=\"radio$f\" value=\"ne\"><br>";} if ($row['form']==2) {$insk++; echo " <input type=\"text\" name=\"text$insk\" maxlength=3 size=4><br>";}//inputas if ($row['form']==3) { $sesk++; echo "<select name=\"selectas$sesk\">"; for ($r=0;$r<=$ssk;$r++) { echo "<option value=\"$zzz[$s]\">$zzz[$s]</option>"; } echo "</select>"; }thanks in advance ;) Link to comment https://forums.phpfreaks.com/topic/19775-mysql-error-in-php-script/ Share on other sites More sharing options...
wildteen88 Posted September 5, 2006 Share Posted September 5, 2006 Its beacuse your are overwritting the result resource in your for loop. $r is the result resource from the SQL Query you have just run. You are assign $r to zeror in the for loop. change $r if your for loop to something else, like $_r that way it wont overwrite the result resource. Link to comment https://forums.phpfreaks.com/topic/19775-mysql-error-in-php-script/#findComment-86420 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.