Adding to SQL DB
Posted: Thu Jan 22, 2004 3:48 pm
I've got a VERY simply script with which I wish to add some data to a DB. As far as I can see, it should work - any ideas why it's not?!
<?php
$connection = mysql_connect ("myhost", "ed", "mypassword");
$date = date("F j, Y");
$confirmednewtoadd = $_POST['confirmednewtoadd'];
$table = "xanews";
$addToDB = "Insert into $table(date, newsitem) values('$date', '$confirmnewtoadd')";
mysql_query($addToDB, $connection);
?>
Thanks,
Ed Ludlow
<?php
$connection = mysql_connect ("myhost", "ed", "mypassword");
$date = date("F j, Y");
$confirmednewtoadd = $_POST['confirmednewtoadd'];
$table = "xanews";
$addToDB = "Insert into $table(date, newsitem) values('$date', '$confirmnewtoadd')";
mysql_query($addToDB, $connection);
?>
Thanks,
Ed Ludlow