Currently, I am working on PHP to make an online shop.
I have my order table.
<?php
$itemno = $_POST['itemno'];
$qty = $_POST['qty'];
$price = $_POST['price'];
$orderno = rand(0,100);
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$streetaddress= $_POST['streetaddress'];
$city = $_POST['city'];
$state = $_POST['state'];
$postcode2 = $_POST['postcode2'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$dat=date("Y-m-d");
include_once('config.php');
$save_items = mysql_query("INSERT INTO orders (itemno,qty,price,orderno,firstname,lastname,streetaddress,city,state,postcode2,email,phone,dat)VALUES('$itemno','$qty','$price','$orderno','$firstname','$lastname','$streetaddress','$city','$state','$postcode2','$email','$phone','$dat')");
if($save_items){
echo '1';
}else{
echo '0';
}
?>
Two things I need help:
I want to access the latest date order in top in order view page. Here is my mysql "select * from orders ORDER BY dat ". What change i should do so i get access the latest date order.
I got error in Phone number it comes like this "2147483647".
... ORDER BY dat DESC;2. What's your expected output for phone number?echo $phone;before executing the query and see what output you're getting.