I do not understand why mysql_query($update) is not executed here. All code seems fine for me, var_dump’ing elements results expected values. echo $passed_title; Is executing without warnings from previous line which as said is not executed (DB is not updated). Why?
$ask_if_empty = "SELECT id FROM content WHERE id='{$passed_id}'";
$ask_if_empty2 = mysql_query($ask_if_empty) or die($error[25]);
if (mysql_num_rows($ask_if_empty2) !== 0)
{
$update = "UPDATE content SET title='{$passed_title}' WHERE id='{passed_id}'";
mysql_query($update) or die($error[25]);
echo $passed_title;
}
You’re missing a
$:I strongly recommend escaping strings before using them in sql queries. You can do this with
mysql_real_escape_string. Otherwise you are open to sql injection attacks:If
$passed_idis an integer you should prevent malicious input by usingintval():