Hye guys...
i am having such a big headache with this code now for sometime..
wats happenin is that i am doing a while loop and then from within the while am tryin to execute and update query so that , but PHP gives out an error sayin that Warning: Supplied argument is not a valid MySQL result resource
i have tried everything..and am even printing my update query and when i see it , the query formed is fine.. and all variables are defined perfectly, here is the code below.. if any one of you guys can find where i am going wrong.. i would be very gratefull...
$select_query = "select * from PPMASTER where batchno='$BatchNo' and SNO between '$FromSer' and '$ToSer'" ;
$result1 = mysql_query($select_query, $mysql_link) or die("Error occured");
}
if (mysql_num_rows($result1) !=0 && $invalid_user==0) {
print "$FromSer, $ToSer, $BatchNo";
print "<table align=\"center\" bordercolorlight=\"#009999\" bordercolordark=\"#CCFF33\" cellpadding=\"3\" cellspacing=\"0\" border=\"1\" width=\"95%\">tr>";
print "<td align=\"center\" style=\"v-align: center\" class=forminputtext width=\"15%\" bgcolor=\"#D9F2FF\">";
print "Username";
print "</td>";
print "<td align=\"center\" style=\"v-align: center\" class=forminputtext width=\"35%\" bgcolor=\"#D9F2FF\">";
print "SerialNo";
print "</td>";
print "<td align=\"center\" style=\"v-align: center\" class=forminputtext width=\"10%\" bgcolor=\"#D9F2FF\">";
print " ";
print "</td>";
print "</tr>";
while ($data=mysql_fetch_array($result1))
{
print "<tr>";
print "<td align=\"center\" style=\"v-align: center\" class=forminputtext width=\"15%\" >";
print "<b>$data[1]</b>";
print "</td>";
print "<td align=\"center\" style=\"v-align: center\" class=forminputtext width=\"35%\" >";
print "<b>$data[0]</b>";
print "</td>";
$update_query = "update SUBSCRIBERS set stopped =1 where batchno='$BatchNo' and username='$data[1]' and password='$data[2]'" ;
$result2 = mysql_query($update_query, $mysql_link) or die("Error occured");
print "<td align=\"center\" style=\"v-align: center\" class=formlabeltext width=\"10%\">";
if (mysql_num_rows($result2) != 0) { print "<b>Stopped</b>"; }
else { print "$update_query";
print "<b>Not Done</b>"; }
print "</td>";
print "</tr>";
}
print "</table>";
print "<br>";
}
[/COLOR]