Jump to content

Can anyone HELP


spearchilduser

Recommended Posts

I cant see the error but it will not store the detais into the database

 

Database structure

 

CREATE TABLE IF NOT EXISTS `quotes` (

  `Quote_ID` int(11) NOT NULL AUTO_INCREMENT,

  `Customer_Location` int(65) NOT NULL,

  `Customer_Destination` int(65) NOT NULL,

  `Customer_People` int(5) NOT NULL,

  `Firm_ID` int(10) NOT NULL,

  `Customer_Price` int(10) NOT NULL,

  PRIMARY KEY (`Quote_ID`)

)

 

CODE

 

<?php

$db = mysql_connect("", "");
mysql_select_db("taxi",$db);


$query="INSERT INTO quotes (Customer_Location,Customer_Destination,Customer_People,Customer_Price,Customer_Wait,Firm_ID)
VALUES ('".$_POST['Customer_Location']."','".$_POST['Customer_Destination']."','".$_POST['Customer_People']."','".$_POST['Customer_Price']."','".$_POST['Customer_Wait']."','".$_POST['Firm_ID']."')";

echo "Data base updated with: " .$_POST["Customer_Location"]. " ".$_POST["Customer_Destination"]." ".$_POST["Customer_People"]." ".$_POST["Customer_Price"]." ".$_POST["Customer_Wait"]." ".$_POST["Firm_ID"] ;

?>

</body>

</HTML>

 

It echos the correct information but doesnt store it into the database?

 

Thank you

Link to comment
Share on other sites

No it should be showing

mysql_query("INSERT INTO quotes (Customer_Location,Customer_Destination,Customer_People,Customer_Price,Customer_Wait,Firm_ID)
VALUES ('".$_POST['Customer_Location']."','".$_POST['Customer_Destination']."','".$_POST['Customer_People']."','".$_POST['Customer_Price']."','".$_POST['Customer_Wait']."','".$_POST['Firm_ID']."')");

 

All the information is being sent from page one using POST then this page is picking the information up and inserting it into the database or should be :(

Link to comment
Share on other sites

yer i no i had it set up wrong first of all ill post it a\ll now

 

<?php

mysql_connect("l", "");
mysql_select_db("taxi");


mysql_query("INSERT INTO quotes (Customer_Location,Customer_Destination,Customer_People,Customer_Price,Customer_Wait,Firm_ID)
VALUES (".$_POST['Customer_Location'].",".$_POST['Customer_Destination'].",'".$_POST['Customer_People'].",".$_POST['Customer_Price'].",".$_POST['Customer_Wait'].",".$_POST['Firm_ID'].")");

echo "Data base updated with: " .$_POST["Customer_Location"]. " ".$_POST["Customer_Destination"]." ".$_POST["Customer_People"]." ".$_POST["Customer_Price"]." ".$_POST["Customer_Wait"]." ".$_POST["Firm_ID"] ;

?>

</body>

</HTML>

 

This is the page that will recive the POST information and hopefully insert it into the database

 

This si the page that posts the information

<html>
<body>

<Form  Action="UserEntry1.php" method="POST" >

All the textboxes etc 

<p><input type="submit" value="Send Details" name="B1"></p>

  </form>

</body>
</html>

Link to comment
Share on other sites

try...

<?php
mysql_connect("l", "");
mysql_select_db("taxi");


$Customer_Location = mysql_real_escape_string($_POST['Customer_Location']);
$Customer_Destination = mysql_real_escape_string($_POST['Customer_Destination']);
$Customer_People = mysql_real_escape_string($_POST['Customer_People']);
$Customer_Price = mysql_real_escape_string($_POST['Customer_Price']);
$Customer_Wait = mysql_real_escape_string($_POST['Customer_Wait']);
$Firm_ID = $_POST['Firm_ID'];

$query = "INSERT INTO quotes (
Customer_Location, 
Customer_Destination, 
Customer_People, 
Customer_Price, 
Customer_Wait, 
Firm_ID) 
VALUES (
'$Customer_Location' , 
'$Customer_Destination' ,
'$Customer_People',  
'$Customer_Price', 
'$Customer_Wait', '$Firm_ID')";

$result = mysql_query($query);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.