spearchilduser Posted January 30, 2012 Share Posted January 30, 2012 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 More sharing options...
ocpaul20 Posted January 30, 2012 Share Posted January 30, 2012 Put literals into your sql and write that away, then replace one literal with one variable and try that, etc Dont you have to actually make the statement execute for it to be written to the database ? :-) Link to comment https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312527 Share on other sites More sharing options...
spearchilduser Posted January 30, 2012 Author Share Posted January 30, 2012 Yer im sending the data from a first page and then this page is getting the information that is posted and inserting it into the databse using the sql INSERT or thats how i thought it was to be done ? Link to comment https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312528 Share on other sites More sharing options...
litebearer Posted January 30, 2012 Share Posted January 30, 2012 quick glance - you are not executing your query $result = mysql_query($query); Link to comment https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312531 Share on other sites More sharing options...
spearchilduser Posted January 30, 2012 Author Share Posted January 30, 2012 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 More sharing options...
litebearer Posted January 30, 2012 Share Posted January 30, 2012 Hmmm that post of code is different from your original post of code. Please show entire code sans password etc Link to comment https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312536 Share on other sites More sharing options...
spearchilduser Posted January 30, 2012 Author Share Posted January 30, 2012 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 More sharing options...
litebearer Posted January 30, 2012 Share Posted January 30, 2012 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 More sharing options...
spearchilduser Posted January 30, 2012 Author Share Posted January 30, 2012 cool thanks that worked fine Link to comment https://forums.phpfreaks.com/topic/256034-can-anyone-help/#findComment-1312559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.