Jump to content

[SOLVED] How can I add data to my new field?


jonathanbee

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);
    }

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.