SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot FrequeNC's Avatar
    Join Date
    Jul 2003
    Location
    Australia
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trying to send an email with values from MySQL - HELP!!!

    I have developed my first shopping cart, and now that I am at the end of it, I feel like I have tripped at the finish line.

    The most important aspect of the cart - getting the order to the supplier - but after all is done, the transaction has gone through, I can not send an email with the contents of the cart to the supplier.

    I have no trouble sending plain emails, but when I try to add values from the database, nothing happens. I have set up all kinds of testing messages to make sure the records are being pulled out, and they are, but nothing...

    I am sending an XML document to the gateway processor, and then when it returns with a true value (to say the card was successful) I made another call to MySQL and tried to concatenate values in a $msg variable.

    Code:
    //email customer with confirmation
    $to1 =$row_rs_customer['email'];
    $subject1 ="Online Order Received - ".$row_rs_purchase['purch_date'];
    $msg1 ="Order received on ".$row_rs_purchase['purch_date'];
    $msg1.= "\n\nOrder placed by ".$row_rs_customer['f_name']." ".$row_rs_customers['l_name'];
    $from1="From: Online Purchase - ".$row_rs_purchase['purch_date'];
    	
    //send the emails
    mail($to1, $subject1, $msg1, $from1);
    Can somebody PLEASE help me. This project is turning out way overdue and today was supposed to be the absolute deadline.
    -----------------
    Tabor Carlton TCID

  2. #2
    PHP manual bot bronze trophy Gaheris's Avatar
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does any data get returned from you query?
    Do you get an error message when you
    PHP Code:
    $res mysql_query($sql) or die(mysql_error()); 
    add this error checking?
    Are any rows returned?
    PHP Code:
    if (!mysql_num_rows($res)) {
        echo 
    'No row/s returned';


  3. #3
    SitePoint Zealot FrequeNC's Avatar
    Join Date
    Jul 2003
    Location
    Australia
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did this check to see if values were being pulled out.

    PHP Code:
    $query "SELECT STUFF...";
    $rs mysql_query ($query);
    if (
    $rs) {
       print 
    "Record was pulled down successfully";

    I will do another check on it and actually print out some values
    (I think I did do this, I am pretty sure I would have when I wasn't getting results, but lack of sleep is blurring my memory...)

    Thanks for the quick reply. I will let you know what I find out with your test...
    -----------------
    Tabor Carlton TCID

  4. #4
    SitePoint Zealot FrequeNC's Avatar
    Join Date
    Jul 2003
    Location
    Australia
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, even though I was getting a confirmation from that last test, using your test it says I am not getting values returned.

    This is tricky for me, because I am using an provided page from the gateway processor that turns the values into an XML document. All of this script is on one page, the first time it is run it just displays the form, then the next time (after the form is submitted) if the value of the credit card is returned true, I can provide actions. Here is my code, you see and errors?

    PHP Code:
    include("../conn.php");
    $linkID mysql_connect($hostname$username$password);
    $cart_ID $HTTP_COOKIE_VARS['cart_ID'];


    //customers record
    mysql_select_db($database$linkID);
    $query_rs_customers "SELECT * from customers WHERE cart_ID = '$cart_ID'";
    $rs_customers mysql_query($query_rs_customers$linkID);
    $row_rs_customers mysql_fetch_array($rs_customers);
    $row_rs_customers_total mysql_num_rows($rs_customers);
    if (!
    $row_rs_customers_total) {
        print 
    "there was no customer information ";

    -----------------
    Tabor Carlton TCID

  5. #5
    PHP manual bot bronze trophy Gaheris's Avatar
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess the cookie wasn't set. Does print_r($_COOKIE) give you any entries?

  6. #6
    SitePoint Zealot FrequeNC's Avatar
    Join Date
    Jul 2003
    Location
    Australia
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, the cookie was set. I set up a page that displayed the cookie value, and kept checking it the whole duration of testing the shopping cart pages. The problem I have tracked down is that it is not pulling the value of just the customer information from the database. It is pulling the order and purchase amount, but not the customr info. the process that I have in place is

    after someone checks out of the cart it takes them to a page that lets them 'log in' using their first name, last name, and email address. if it is recognized then a page is displayed allowing them to check/change info. The cookie holding the 'cart_ID' that has been tracking the order is updated in the customers table, so everything has one field in common - the value of the cookie. on the processing page, I pull out all the records that hold the value of the cookie, but then I am left with what I currently have. No info getting pulled out of the customers table, but the others are ok. Any ideas on that process. Any way I could do it better?
    -----------------
    Tabor Carlton TCID


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •