hi
i want to insert date through mysql query

<?php 
 require_once('auth.php');
 require_once('connection/config.php');

    //Connect to mysql server
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    if(!$link) {
        die('Failed to connect to server: ' . mysql_error());
    }

    //Select database
    $db = mysql_select_db(DB_DATABASE);
    if(!$db) {
        die("Unable to select database");
    }
?>
<form method ="post" action ="">
<?php

$name=$_POST['name'];
$quantity=$_POST['quantity'];
$price=$_POST['price'];
$total=$_POST['total'];
$transactioncode=$_POST['transactioncode'];

?>
<input name="transactioncode" type="hidden" value="<?php echo $transactioncode;?>" />
<input name="total" type="hidden" value="<?php echo $total;?>" />

<input name="name" type="hidden" value="<?php echo $name;?>" />
<input name="quantity" type="hidden" value="<?php echo $quantity;?>" />
<input name="price" type="hidden" value="<?php echo $price;?>" /></form>
<?php
$name=$_POST['name'];
$quantity=$_POST['quantity'];
$price=$_POST['price'];
$total=$_POST['total'];
$trasactiondate=date("d/m/Y");
$transactioncode=$_POST['transactioncode']; 

$regnum = $_POST['regnum'];

$data = mysql_query("SELECT * FROM  members where member_id=$transactioncode") or die(mysql_error());  
 while($info = mysql_fetch_array( $data )) {
 $reg = $info['regnum'];
} 
if($regnum != $reg){
echo "wrong regnum Num";
exit(0);
}



mysql_query("INSERT INTO order_items
SELECT * 
FROM cart_items");


?>
<div> 
<a  href="foodorders.php"><img src="images/dine1.png" width="100%" height="80%" />click here view your order </a>
Thank you ! your order has been placed succesfully ... .</div>

im copying all the data from one table to the other table so i want to insert date which is not in the other table .the date should be inserted in new table only.

just add the date to your insert/select statement

mysql_query("INSERT INTO order_items(transactiondate) values($transactionsdate)
SELECT *
FROM cart_items");
is this will insert date

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.