Inserting into a database problem???
Posted: Tue Dec 14, 2004 5:46 pm
hi the problem i have is that my function won't insert anything into the table i want it to. can anyone see if there is a problem with my coding, the database connections are fine.
Code: Select all
<? function insert_vinyl()
{
$title = $_POST['title'];
$artist = $_POST['artist_id'];
$release_date = $_POST['year']."-".$_POST['month']."-".$_POST['date'];
$genre = $_POST['genre_id'];
$price = $_POST['price'];
$qty = $_POST['qty'];
$info = $_POST['comments'];
$link_id = db_connect();
$query = "insert into vinyls(cat_no, title, artist_id, release_date, genre_ref, price, stock_level, vinyl_information)
values( NULL, "$title", "$artist", "release_date" , "$price" , "$qty" ,"$info")";
$result = mysql_query($query, $link_id);
if($result)
{
echo 'Succesfully Entered';
}
else
echo 'ERROR';
}
if($_GET['action'] == "addrecord")
{
insert_vinyl();
exit;
break;
}else
?>