I have tried for several days to debug my code but cannot. I would certainly be grateful for some help.
I have some very simple code to INSERT data into the cdcol database that comes with xampp. when I collect the data from a form it doesn't work but when I write the data into the SQL and run the query it does work.
In more detail the code doesn't appear to produce any effect when the data is collected from the form. When the data is written directly into the query and submitted via the form submit button it is executed twice and a duplicate row in the table is produced.
I have tried another script which has a similar effect, this is more complicated using include files and a function library in its infancy. I have noticed that this other script introduces blank records except for the year which is 0 and the key field which is set to auto increment.
The code is as follows.
- Code: Select all
<form action="AddNewLocal3.php" method="post"> <!--form calls itself-->
Title: <input type="text" name="Title"><br>
Interpret: <input type="text" name="Interpret"><br>
Year: <input type="text" name="Year"><br>
$titel = $_POST['Title'];
$interpret = $_POST['Interpret'];
$jahr = $_POST['Year'];
@mysql_select_db(cdcol) or die( "Unable to select database");
$qry = "INSERT INTO cds VALUES ('$interpret', '$titel', '$jahr')"; // This does not work 10/06/05
//$qry = ("INSERT INTO cds VALUES ( 'Joan Baez', 'Diamonds and Rust', '1970', '0') "); //This works twice??
Can you help please?
I certainly look forward to hearing from anyone.