I have to have my thesis in today, thank you for your help though, I just thought it would be something simple...my supervisor made me change a load of things last Thursday!
Thank you for all your help though, I am not ungrateful!
If I go inserting another table too much has to be changed but if it's the only way to do it thats okay!
Here's another problem though!
I keep getting this message:
Duplicate entry '0' for key 2
I am trying to match id's in order to create a link between my two tables by matching the name in one table with the name the user enters,
Any Suggestions?
Here's my php code:
<?php
//connect to MySQL
$conn = @mysql_connect("localhost", "mags", "mags101")
or die("Could not connect to MySQL");
//select the specified database
$rs = @mysql_select_db("allensbushire", $conn)
or die("Could not select database");
#compare names and get the id that matches that name!
$sql="select customer_id from customer where customer_name='$HTTP_POST_VARS[requiredjname]'";
$rs1=mysql_query($sql)or die (mysql_error());
#get number of rows that match query
$num = mysql_numrows($rs1);
#if there is a match the data from the form is entered!
if($num != 0)
{
$row= mysql_fetch_array($rs1);
$sql = "INSERT INTO journey (journey_date, customer_id, commence_location, end_location, number_passengers, journey_duration, pickuptime, pickuplocation) VALUES ('$HTTP_POST_VARS[requiredjdate]', '$row[0]', '$HTTP_POST_VARS[requiredcommloc]', '10 Miles', '$HTTP_POST_VARS[requirednopass]', '$HTTP_POST_VARS[requiredjdur]', '$HTTP_POST_VARS[requiredpickuptime]', '$HTTP_POST_VARS[requiredpickuploc]')";
$result = mysql_query($sql)or die (mysql_error());
#$rs2=mysql_query($sql, $conn);
#header("Location: CreditCard Page.htm");
}
else
{
echo("INCORRECT!");
exit();
}
?>
Any help would be greatly appriciated!
Cheers!