cargi Posted March 25, 2006 Share Posted March 25, 2006 Hi guys just a quicky here i hope. I have two pages one a html form and the other the php file below. I am trying to send the data from the form into my mysql database. I am using the code below, everything seems to work fine, i mean no error messages appear... but it doesnt actually enter the data into the db please help cheers. Cargiwww.TheMillionDollarMovieProject.com'Become a movie producer today!'<?$username="xxxxx";$password="xxxxxx";$database="xxxx";$host="xxxxxxxxxxxxxx";$first=$_POST['first'];$last=$_POST['last'];$dob=$_POST['dob'];$city=$_POST['city'];$country=$_POST['country'];$email=$_POST['email'];$donation=$_POST['donation'];$proNum=$_POST['proNum'];mysql_connect($host,$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query = "INSERT INTO producers VALUES ('','$first','$last','$dob','$city','$country','$email','$donation','$proNum'";mysql_query($query);mysql_close();?> Quote Link to comment https://forums.phpfreaks.com/topic/5814-form-submission-problem/ Share on other sites More sharing options...
azuka Posted March 26, 2006 Share Posted March 26, 2006 Are you sure short tags are enabled on your server? Try calling echo () from inside the block. If it doesn't work then you should chnage "<?" to "<?php" Quote Link to comment https://forums.phpfreaks.com/topic/5814-form-submission-problem/#findComment-20745 Share on other sites More sharing options...
shortj75 Posted March 26, 2006 Share Posted March 26, 2006 the problem is you are not telling the query what columns to put the values in try something like this[code]$query="INSERT INTO producers(your_first_column_name,your_second_column_name,your_third_column_name,your_fourth_column_name,your_fifth_column_name,your_sixth_column_name, your_seventh_column_name,your_eightth_column_name,your_ninth_column_name)VALUES ('','$first','$last','$dob','$city','$country','$email','$donation','$proNum')";mysql_query($query);[/code]just change all of the your_first_column_names to the real column names like(first,last,dob,and so on)and that should fix your problem and where it says ( it is supposed to be ( it changsd when i posted it and wont let me fix it Quote Link to comment https://forums.phpfreaks.com/topic/5814-form-submission-problem/#findComment-20798 Share on other sites More sharing options...
kenrbnsn Posted March 26, 2006 Share Posted March 26, 2006 Put an "or die" clause on your mysql_query() function:[code]<?php$query = "INSERT INTO producers VALUES ('','$first','$last','$dob','$city','$country','$email','$donation','$proNum'";mysql_query($query) or die('Problem with query:<span style="color:red>' . $query . '</span><br>' . mysql_error());?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/5814-form-submission-problem/#findComment-20838 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.