Help with mysql and php form variables!
Posted: Tue Dec 07, 2010 10:11 pm
I can't figure this thing out! I'm still kinda new to php. I'm making a family tree website. I'm trying to hand build the CMS but, alas, I'm having trouble. I know there must be something so simple that I'm missing. I have a MYSQL database with 9 different tables. Instead of building 9 different insert record pages, I decided to use a switch statement to determine which table to edit. So the basics of it, I have a page with links and a URL variable. Each link sends a different value to the next page. The new page then determines from the URL variable which form and table to build. I have no problem with this part. Its my processor page. After inputting the data in the form and submitting, I keep getting SQL errors!
Here's a snippet from the processor page.
THE ERROR I KEEP GETTING "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, dod, fname, img, lname, rootID) VALUES ('', 'asdf' '', '', '', '', 'sdf')' at line 1"
I know that all my values from the form are getting there because I can echo them.
I'm positive all my fields name match up.
What am I missing?
Here's a snippet from the processor page.
Code: Select all
<?php require_once('../Connections/conn_gilliam.php');
mysql_select_db($database_conn_gilliam, $conn_gilliam);
?>
<?php switch ($_GET['tbl']) {
case "1";
$query_rs_insert_gen = "INSERT INTO tbl_gen (dob, desc, dod, fname, img, lname, rootID) VALUES ('".$_POST['dob']."', '".$_POST['desc']."', '".$_POST['dod']."', '".$_POST['fname']."', '".$_POST['img']."', '".$_POST['lname']."', '".$_POST['pk']."');";
$rs_insert_gen = mysql_query($query_rs_insert_gen) or die(mysql_error());
break;
I know that all my values from the form are getting there because I can echo them.
I'm positive all my fields name match up.
What am I missing?