Community Forums 

Main Content

remote call with myspl

    May 24 2011 15:38:58

    #1

    totr

    Join date : 2010-04-03      Posts : 17

    Hi Everyone,

    I am getting stuck with thsi remote call. I am using the php/mysql script which I have set up on my server ok and have uploaded cart_insert.php and config.php

    When I add to my oder and checkout I get an email from the website

    HTTP/1.1 206 Partial Content
    Date: Tue, 24 May 2011 15:19:13 GMT
    Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.14
    X-Powered-By: PHP/5.2.14
    Content-Range: bytes 0-4/5
    Content-Length: 5
    Content-Type: text/html

    Done

    So no errors here but my database entry remains empty. I have the remote call using post with my domain to cart_insert.php.

    I literally oulling my hair out - whats left of it. Any help would be appreciated

    Thanks
    Eric



    May 25 2011 06:26:04

    #2

    totr

    Join date : 2010-04-03      Posts : 17

    Fixed it,

    On Mals click remote call and enter your path to cart_insert.php

    eg www.mydomain.com/cart_insert.php

    method POST

    Next

    I changed in mysql the id to an auto_increment and removed the default option.

    Then chanded the cart_order.php script to :

    <?PHP
    include("config.php");
    mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database $DBName");

    mysql_select_db($DBName) or die("Unable to select database $DBName");

    $order_date=time("m j y h:i");

    // create varibles

    $id = $_POST['id'];
    $username = $_POST['username'];
    $ip = $_POST['ip'];
    $method = $_POST['method'];
    $cart = $_POST['cart'];
    $discount = $_POST['discount'];
    $subtotal = $_POST['subtotal'];
    $shipping = $_POST['shipping'];
    $tax = $_POST['tax'];
    $total = $_POST['total'];
    $shipping_zone = $_POST['shipping_zone'];
    $inv_name = $_POST['inv_name'];
    $inv_company = $_POST['inv_company'];
    $inv_addr1 = $_POST['inv_addr1'];
    $inv_addr2 = $_POST['inv_addr2'];
    $inv_state = $_POST['inv_state'];
    $inv_zip = $_POST['inv_zip'];
    $inv_country = $_POST['inv_country'];
    $del_name = $_POST['del_name'];
    $del_addr1 = $_POST['del_addr1'];
    $del_addr2 = $_POST['del_addr2'];
    $del_state = $_POST['del_state'];
    $del_zip = $_POST['del_zip'];
    $del_country = $_POST['del_country'];
    $tel = $_POST['tel'];
    $fax = $_POST['fax'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    // query insert

    mysql_query("INSERT INTO orders (id,username,ip,date,method,cart,discount,subtotal,shipping,tax,total,shipping_zone,inv_name,inv_company,inv_addr1,inv_addr2,inv_state,inv_zip,inv_country,del_name,del_addr1,del_addr2,del_state,del_zip,del_country,tel,fax,email,message)

    VALUES
    ('$id',
    '$username','$ip','$order_date','$method','$cart','$discount','$subtotal','$shipping','$tax','$total','$shipping_zone','$inv_name','$inv_company','$inv_addr1','$inv_addr2','$inv_state','$inv_zip','$inv_country','$del_name','$del_addr1','$del_addr2','$del_state','$del_zip','$del_country','$tel','$fax','$email','$message')");

    ?>

    Done


    ----------------------------------------------------------------------------------------

    Now works perfect !! Hope it help others who struggled like me !!

    Eric



    Sep 08 2011 20:59:28

    #3

    CaptainM

    Join date : 2011-09-08      Posts : 2

    This was a great help, the original script didn't work for me either. Thanks!

    I need the "product" information to be sent to the mySQL database too. I thought this might be as easy as adding the "product" reference in the file (see below). I created a new column on the mySQL database but the product field is not populated post-submission. How can I achieve this?

    <?PHP
    include("config.php");
    mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database $DBName");

    mysql_select_db($DBName) or die("Unable to select database $DBName");

    $order_date=time("m j y h:i");

    // create variables

    $id = $_POST['id'];
    $username = $_POST['username'];
    $ip = $_POST['ip'];
    $method = $_POST['method'];
    $cart = $_POST['cart'];
    $product = $_POST['product'];
    $discount = $_POST['discount'];
    $subtotal = $_POST['subtotal'];
    $shipping = $_POST['shipping'];
    $tax = $_POST['tax'];
    $total = $_POST['total'];
    $shipping_zone = $_POST['shipping_zone'];
    $inv_name = $_POST['inv_name'];
    $inv_company = $_POST['inv_company'];
    $inv_addr1 = $_POST['inv_addr1'];
    $inv_addr2 = $_POST['inv_addr2'];
    $inv_state = $_POST['inv_state'];
    $inv_zip = $_POST['inv_zip'];
    $inv_country = $_POST['inv_country'];
    $del_name = $_POST['del_name'];
    $del_addr1 = $_POST['del_addr1'];
    $del_addr2 = $_POST['del_addr2'];
    $del_state = $_POST['del_state'];
    $del_zip = $_POST['del_zip'];
    $del_country = $_POST['del_country'];
    $tel = $_POST['tel'];
    $fax = $_POST['fax'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    // query insert

    mysql_query("INSERT INTO orders (id,username,ip,date,method,cart,product,discount,subtotal,shipping,tax,total,shipping_zone,inv_name,inv_company,inv_addr1,inv_addr2,inv_state,inv_zip,inv_country,del_name,del_addr1,del_addr2,del_state,del_zip,del_country,tel,fax,email,message)

    VALUES
    ('$id',
    '$username','$ip','$order_date','$method','$cart','$product','$discount','$subtotal','$shipping','$tax','$total','$shipping_zone','$inv_name','$inv_company','$inv_addr1','$inv_addr2','$inv_state','$inv_zip','$inv_country','$del_name','$del_addr1','$del_addr2','$del_state','$del_zip','$del_country','$tel','$fax','$email','$message')");

    ?>