I'm fairly new to php and very new to MySQL. My question is this, how do I grab the value from the fields startdate and cycle from the database table customer_t?

Basically what I want to do is this: I want to have a form for updating periodic billing information. The startdate and cycle that the customer is on is already in the billing database of our merchant gateway. By using the orderID of the periodic bill, it will search for that order number and then modify the tables with the new information provided in my form.

Problem is this, our merchant gateway, Linkpoint, require that we pass a startdate and periodicity(cycle) in order for the modify to process. I don't want the startdate to change nor the cycle. When the customer first signs up, say for monthly billing, that sets the cycle to 'm1' in the database telling it to bill them every month from the startdate. The startdate is set when the order is placed. So when the customer is using our updatebilling.php form, it simply asks them for the orderID and their new billing information. It doen't ask for the cycle or startdate. If the customer is billed on the 1st of every month but updates their information on the 7th and submit it, it would replace the startdate to the 7th and not bill them on the 1st. I want the billing date to remain the same.

I keep a seperate SQL database of our customers info which has the startdate and cycle but not credit card info. How can I grab those values, the original startdate and cycle from my database and then pass them to the billing database?

I hope this isn't too long of an explanation.

Thanks

    Let me try this a little differently. How do I connect to my MySQL database using PHP to retrieve the data in the fields 'startdate' and 'cycle' from the customer_t table? I have no idea how to connect to a database.

    This is some of the code that I'm passing over the gateway to be modified for periodic billing:

    This page is called submitUpdateBilling.php where all values from updateBilling.php are passed.

    <?php
    include"lpphp.php";
    $mylpphp=new lpphp;
    
    /* The first 5 parameters must be modified to reflect the
    ** information provided to you for YOUR store
    **
    ** result should be set to LIVE when doing
    ** live transactions on [url]https://secure.linkpt.net[/url]
    */
    
    $myorder["host"]="secure.linkpt.net";
    $myorder["port"]="1129";
    $myorder["storename"]="storename"; 
    $myorder["keyfile"]="/path to .pem file"; 
    $myorder["result"] = "LIVE";    
    
    
    /* These parameters are for test purposes only.  In
    ** your implementation, they will reflect the information
    ** needed for your specific transactions
    **
    ** NOTE: setting the test email address to your own email
    ** address will result in the receipt email being sent
    ** to you, which will help to know that the script is
    ** functioning properly.
    */
    $myorder["cardNumber"]=$cardnumber;
    $myorder["cvmvalue"]=$code;
    $myorder["cvmindicator"]=$cvmindicator;
    $myorder["cardExpMonth"]=$expMonth;
    $myorder["cardExpYear"]=$expYear;
    $myorder["name"]=$bname;
    $myorder["email"]=$email;
    $myorder["phone"]=$phone;
    $myorder["address"]=$baddr;
    $myorder["city"]=$bCity;
    $myorder["state"]=$bState;
    $myorder["zip"]=$bZip;
    $myorder["country"]=$bCountry;
    
    
    // periodic specific fields
    $myorder["startdate"]= this is where I want the data from the startdate field from the MySQL database to go;
    $myorder["periodicity"]=this is where I want the data from the cycle field from the MySQL database to go;
    $myorder["installments"]=99;
    $myorder["threshold"]=3;
    $myorder["pbordertype"]="PbOrder_Submit";
    

    Using this page, how and where do I connect to the database to retrieve those values from customer_t?

    Thanks.

    BTW, I am the same person as skdzines who originally posted.

      the real problem here is you are not sure how to update a db row where the values are not to change ever...the simple answer is that in your updatebilling.php you need to remove the references to the fields in question (startdate and cycle) and only update the info that needs to be changed...

      you could add a column to the table called billing_update or something like similar that would show the date when the data is updated...then the original values won't change...

      hth

        If I don't pass the two values that are never to be changed, it will spit out an error saying that the startdate is required and won't modify anything. Linkpoint requires those values to be passed.
        The thing is that these are two seperate databases. One is our own that we keep for our records which contains the startdate and cycle, as does the billing database from Linkpoint, but doesn't keep any credit card numbers and such. The database that I want to be able to modify is the billing database that Linkpoint keeps. Problem is that they require that we pass the

        $myorder["startdate"]= this is where I want the data from the startdate field from the MySQL database to go; 
        $myorder["periodicity"]=this is where I want the data from the cycle field from the MySQL database to go;
        

        even when we are doing a modify. But like I said, if I have it capture the date of the actual transaction or time of modification in this case, it will replace the startdate with a new time, which is what I don't want. Also the user isn't going to know to put in the value 'm1' or 'm6' for the cycle. Some might be on monthly billing others might be semi-annual(m6) or annually(y1). This is why I need to connect to the customer_t table of our database to pull those values for startdate and cycle and pass them into this script to update the merchants db.

        So how do I connect to the database to grab those values of the corresponding orderID?

        Thanks.

          is it 2 dbs or 2 tables? big diff...

          what you should have is a table called customers with the following field (ex)

          cust_id
          cust_fname
          cust_lname
          cust_co_name
          cust_bill_cycle
          cust_startdate (set once when cust signs up)
          cust_mod_info_date
          etc

          transaction table
          order_id
          cust_id
          item_no
          quantity
          total_order
          etc

          to connect the two tables to fill in the form for processing

          select c.cust_fname,c.cust_lname, c.cust_startdate, c.cust_bill_cycle, t.order_id, t.total_order
          from
          customer c,
          transactions t
          where
          c.cust_id = t.cust_id and
          t.order_id = $orderidfromform

          you should NEVER store CC numbers in an unprotected webserver based db...if it gets hacked you are screwed...

            They are 2 seperate databases. Ours is just a simple MySQL database that we store customer contact and package information on. Which package they ordered, what the billing cycle is, startdate, etc.. We don't keep any CC information in our db. The other is the protected billing database that Linkpoint, our merchant gateway, keeps for all periodic billing transactions, since all of our transactions are recurring. We are a web hosting company.

            So basically what I have is a form called updateBilling.php that the user will enter their orderID # from their recurring statement and new billing and credit card information over our secure connection. When the user clicks submit, it calls the page submitUpdateBilling.php which contains the code above to pass all values to the billing database to be modified. At this point I need to connect to our customer_t table of our customer db, search for the 'orderID' and then grab the values stored in 'startdate' and 'cycle' for this particular customer and pass those along with everything else to be modified. This way, 'startdate' and 'cycle' won't get changed to a new value, such as the current date.

              So essentially, this is what I need once it reaches the submitUpdateBilling.php page which will send all of the information to be modified in the billing database that Linkpoint keeps.

              <?php 
              include"lpphp.php"; 
              $mylpphp=new lpphp; 
              
              Connect to our database;
              Find matching orderID;
              get values from 'startdate' and 'cycle';
              
              
              /* The first 5 parameters must be modified to reflect the 
              ** information provided to you for YOUR store 
              ** 
              ** result should be set to LIVE when doing 
              ** live transactions on [url]https://secure.linkpt.net[/url] 
              */ 
              
              
              $myorder["host"]="secure.linkpt.net"; 
              $myorder["port"]="1129"; 
              $myorder["storename"]="storename";  
              $myorder["keyfile"]="/path to .pem file";
              $myorder["result"] = "LIVE"; /* These parameters are for test purposes only. In ** your implementation, they will reflect the information ** needed for your specific transactions ** ** NOTE: setting the test email address to your own email ** address will result in the receipt email being sent ** to you, which will help to know that the script is ** functioning properly. */ $myorder["cardNumber"]=$cardnumber; $myorder["cvmvalue"]=$code; $myorder["cvmindicator"]=$cvmindicator; $myorder["cardExpMonth"]=$expMonth; $myorder["cardExpYear"]=$expYear; $myorder["name"]=$bname; $myorder["email"]=$email; $myorder["phone"]=$phone; $myorder["address"]=$baddr; $myorder["city"]=$bCity; $myorder["state"]=$bState; $myorder["zip"]=$bZip; $myorder["country"]=$bCountry; // periodic specific fields $myorder["startdate"]= insert variable which contains startdate from customer database here; $myorder["periodicity"]= insert variable which contains cycle from customer database here; $myorder["installments"]=99; $myorder["threshold"]=3; $myorder["pbordertype"]="PbOrder_Submit";
                Write a Reply...