jim.davidson Posted April 4, 2007 Share Posted April 4, 2007 First I'm using PHP 5.0, mySQL 4.1.21 and Dreamweaver8 Here's what I'm trying to do on-line customer fills out a form for contact information. I save this to session variables. Customer goes to next page adds item(s) to cart then goes to checkout page. At this point I'm sure I got a customer so I want to add the session info into a table called customers. I then need to capture the customer id from the insert so that I can add it to the orders table(next step if I ever get through this step) Here's my code for the insert(doesn't work) would appreciate any help //WA eCart Redirect Check Out if (isset($_POST["Recycle_Checkout_1"]) || isset($_POST["Recycle_Checkout_1_x"])) { $Redirect_redirStr="test_checkout.php"; // place insert customer info here $insertSQL = sprintf("INSERT INTO customers (first_name, last_name, address_1, address_2, city, state, zip, contact_name, contact_phone, contact_email, contact_comments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_SESSION['contact_first_name'], "text"), GetSQLValueString($_SESSION['contact_last_name'], "text"), GetSQLValueString($_SESSION ['conntact_address1'], "text"), GetSQLValueString($_SESSION ['contact_address2'], "text"), GetSQLValueString($_SESSION ['contact_city'], "text"), GetSQLValueString($_SESSION ['contact_state'], "text"), GetSQLValueString($_SESSION ['contact_zip'], "text"), GetSQLValueString($_SESSION['contact_name'], "text"), GetSQLValueString($_SESSION['contact_phone'], "text"), GetSQLValueString($_SESSION['contact_email'], "text"), GetSQLValueString($_SESSION['contact_comments'], "text")); $_SESSION['cust_id'] = mysql_insert_id(); mysql_select_db($database_imcrecycle, $imcrecycle); $Result1 = mysql_query($insertSQL, $imcrecycle) or die(mysql_error()); // end of insert here's the error Fatal error: Call to undefined function GetSQLValueString() in C:\Sites\test_display_cart.php on line 49 line 49 is GetSQLValueString($_SESSION['contact_first_name'], "text"), Link to comment https://forums.phpfreaks.com/topic/45584-solved-need-help-with-insert/ Share on other sites More sharing options...
fenway Posted April 4, 2007 Share Posted April 4, 2007 Sounds like you're missing an include... but this isn't a MySQL problem. Link to comment https://forums.phpfreaks.com/topic/45584-solved-need-help-with-insert/#findComment-221571 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.