php insert database not working
I'm wondering why the code below can't add my data into the database,
there's no error message whatsoever.
trans_id is in INT(11) data type, subject and useid is in VARCHAR(45).
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect to the database! ' . mysql_error());
}
//Accessing the database
$db_selected = mysql_select_db("ebook", $con);
if (!$db_selected) {
die ('Database error!' . mysql_error());
}
else
mysql_query($con, "INSERT INTO free_chapters (trans_id, subject,
useid) VALUES ($transactionId, 'Chemistry', $useid)");
No comments:
Post a Comment