Jump to content

[SOLVED] Need help with insert


jim.davidson

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.