I’m just starting to learn about how to use MySQL database. I insert data using the code that is listed below. It puts the first record in as record 0, but when I look at it, it says it has and ID# of 1. I have it set to autoincrement.
What am I missing?
Here is my code to insert it:
[code=php]
<?php
// Inserts question into drmarie_questions MySQL database
$ownername=$_POST[‘ownername’];
$petname=$_POST[‘petname’];
$species=$_POST[‘species’];
$breed=$_POST[‘breed’];
$age=$_POST[‘age’];
$email=$_POST[’email’];
$question=$_POST[‘question’];
mysql_connect(“localhost”, “deleted”, “deleted”) or die(mysql_error());
mysql_select_db(“drmarie_questions”) or die(mysql_error());
mysql_query(“INSERT INTO question_table (ownername,petname,species,breed,age,email,question)
VALUES (‘$ownername’,’$petname’,’$species’,’$breed’,’$age’,’$email’,’$question’)”) or die(mysql_error());
mysql_close();
?>
If anyone can point me in the right direction I would be very appreciative!
Thanks!
Marie