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
https://forums.phpfreaks.com/topic/256034-can-anyone-help/
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
https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312532
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
https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312537
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
https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312546
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.