|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Script no inserting data to table
I submit the form to insert the data into the table, when I submit the form for this script to process, The "if" statement is true because the "echo" statement in the else says so, but the else is what the script is doing. Can't figure out why.
What am I missing here? <html><body> <?php include ("dbconnect_test.php"); if ($submit == "Submitted") { echo ("Submit ='Submitted'"); $query = "insert into tbl_members (name,chapter,position,category,business_name,addr ess1,address2,city,state,zip,phone,fax,e-mail,web_address) values ('$name','$chapter','$position','$category','$busi ness_name','$address1','$address2','$city','$state ','$zip','$phone','$fax','$e-mail','$web_address')" ; mssql_query($query) or die ("unable to Insert Data"); ?> <h2>Thanks!!</h2> <h2><a href="view.php"> View The List </a></h2> <?php } else { echo ("Submit ='Submitted'"); echo "Doing the else"; include("members_test.php"); } ?> </body></html> |
|
#2
|
|||
|
|||
|
RE: Script no inserting data to table
As an update to this, I've removed the "if and else" to just make it proceed with the insert, and it's not working, getting the "die-message". Anyone have any suggestions here?
|
|
#3
|
|||
|
|||
|
RE: Script no inserting data to table
hrm, at first glance everything looks fine to me..
the only thing i would suggest is that you make sure you've spelt all your names correctly in the SQL statement, as that appears to be where the problem is.. |
|
#4
|
|||
|
|||
|
RE: Script no inserting data to table
Yes, I've corrected that, and also removed all the column specs as that is interpreted to insert all columns. I'm still getting the "unable to Insert Data". I'm also using the echo statements to make sure the variables are correct but the script is not inserting them.
<?php include ("dbconnect_test.php"); echo "<BR>"; echo "Receives ($name)"; echo "Receives ($chapter)"; echo "<BR>"; mysql_query ("INSERT INTO tbl_members",$db) or die ("unable to Insert Data"); ?> |
|
#5
|
|||
|
|||
|
RE: Script no inserting data to table
$query = "insert into tbl_members
(name,chapter,position,category,business_name,addr ess1,address2,city,state,zip,phone,fax,e-mail,web_address) values ('$name','$chapter','$position','$category','$busi ness_name','$address1','$address2','$city','$state ','$zip','$phone','$fax','$e-mail','$web_address')"); try that |
|
#6
|
|||
|
|||
|
RE: Script no inserting data to table
How bout' case sensitivity should Submitted be submitted with small "s"
|
|
#7
|
|||
|
|||
|
RE: Script no inserting data to table
Oh, one more thing You dont have a closing bracket brfore ?>
|
|
#8
|
|||
|
|||
|
RE: Script no inserting data to table
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Script no inserting data to table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|