irl33thax0r
Member
I'm writing a backend interface for a website that will allow the user to update news articles and such via an HTTP form. I'm using the latest version of PHP with the latest version of MySQL. My problem is this... how do I insert PHP variables into a DB?
include('./include.php');
$newsdb = mysql_connect("localhost", $dbuser, $dbpass);
mysql_select_db($newsname, $newsdb);
mysql_query("insert INTO events (title, summary, delist, date, displaydate) VALUES ('$_POST[title]', '$_POST[summary]', '$_POST[delist]', '$_POST[date]', '$_POST[ddate]'");
echo $title;
This generates no errors, and is based on some source code I found while searching around google. But either way it doesn't work. I even echo'd the variables to the screen to make sure they weren't null, and sure enough they contained the correct strings. Any thoughts on how to get it to work?
include('./include.php');
$newsdb = mysql_connect("localhost", $dbuser, $dbpass);
mysql_select_db($newsname, $newsdb);
mysql_query("insert INTO events (title, summary, delist, date, displaydate) VALUES ('$_POST[title]', '$_POST[summary]', '$_POST[delist]', '$_POST[date]', '$_POST[ddate]'");
echo $title;
This generates no errors, and is based on some source code I found while searching around google. But either way it doesn't work. I even echo'd the variables to the screen to make sure they weren't null, and sure enough they contained the correct strings. Any thoughts on how to get it to work?