Jump to content

Recommended Posts

I've added a 4th field to my TABLE_ORDER, but I can't figure out how to insert data into this new field..  The variable is called mailingList. Advice very appreciated!

 

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

in confirm.php:

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

//database stuff

 

$order = new order($email);

$orderNumber = $order->saveOrder($db);

 

//end database stuff

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

in order.class.php:

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

 

<?php

 

class order {

 

var $email;

 

    function order($email) {

    $this->email = $email;

    }

   

    function saveOrder($db)

    {

    $query = "INSERT into `" . TABLE_ORDER . "`(`o_id`, `date`, `email`) VALUES('', now(), '" . $this->email . "')";

    $db->execute($query);

    return $this->getMaxOrderNumber($db);

    }

   

    function getMaxOrderNumber($db)

    {

    $result = $db->execute("SELECT MAX(`o_id`) FROM `" . TABLE_ORDER . "`");

    return $result->fields['MAX(`o_id`)'];

    }

}

?>

show how you put value on your mail variable or try

$order->saveOrder($db ,'newfield');


//your function 

function saveOrder($db, $newfield)
    {
       $query = "INSERT into `" . TABLE_ORDER . "`(`o_id`, `date`, `email`, `newfield`) VALUES('', now(), '" . $this->email . "','$newfield')";
       $db->execute($query);
       return $this->getMaxOrderNumber($db);
    }

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.