Undefined variable notice in php/mysql
I'm trying to update some records in by database via php. This is the part
of my code that returns error:
// Check if button name "Submit" is active, do this
if(isset($_POST['Submit'])){
for($i=0;$i<$count;$i++){
$query="UPDATE products SET title='$title[$i]', descr='$descr[$i]',
price='$price[$i]', cname='$cname[$i]' WHERE pid='$pid[$i]'";
$upd=mysql_query($query);
}
}
if($upd){
echo "Successful";
echo "<BR>";
//display_manager_menu();
}
else {
echo "ERROR";
}
It returns: "Notice: Undefined variable: upd ". Since I set $upd as
mysql_query result, I have no idea why I get this message. Any ideas?
No comments:
Post a Comment