1 Replies - 189 Views - Last Post: 07 March 2019 - 05:43 AM Rate Topic: -----

#1 peck   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 23-December 10

Field 'user' doesn't have a default value

Posted 07 March 2019 - 04:59 AM

When I use wamp the system works very well, i can add and update but when i upload it to cpanel, i can add but i cant update. so when i check my error log on the cpanel i got this error message ([19-Feb-2019 17:26:29 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/evercour/public_html/deprixa/database.php on line 29)
secondly, this is my update source code





function addcourier_update(){
$cid = (int)$_POST['cid'];
$Shippername = $_POST['Shippername'];
$Shipperphone = $_POST['Shipperphone'];
$Shipperaddress = $_POST['Shipperaddress'];
$Shippercc = $_POST['Shippercc'];

$Receivername = $_POST['Receivername'];
$Receiverphone = $_POST['Receiverphone'];
$Receiveraddress = $_POST['Receiveraddress'];
$Receivercc_r = $_POST['Receivercc_r'];
$Receiveremail = $_POST['Receiveremail'];

$ConsignmentNo = $_POST['ConsignmentNo'];
$Shiptype = $_POST['Shiptype'];
$Weight = $_POST['Weight'];
$variable = $_POST['variable'];
$shipping_subtotal = $_POST['shipping_subtotal'];
$Invoiceno = $_POST['Invoiceno'];
$Qnty = $_POST['Qnty'];

$Bookingmode = $_POST['Bookingmode'];
$Totalfreight = $_POST['Totalfreight'];
$Totaldeclarate = $_POST['Totaldeclarate'];
$Mode = $_POST['Mode'];

$Packupdate = $_POST['Packupdate'];
$Schedule = $_POST['Schedule'];
$Pickuptime = $_POST['Pickuptime'];
$status = $_POST['status'];
$Comments = $_POST['Comments'];
$officename = $_POST['officename'];
$user = $_POST['user'];

$sql = "UPDATE courier
SET cons_no='$ConsignmentNo', ship_name='$Shippername',phone='$Shipperphone',s_add='$Shipperaddress', cc='$Shippercc', rev_name='$Receivername',r_phone='$Receiverphone',r_add='$Receiveraddress', cc_r='$Receivercc_r', email='$Receiveremail', type='$Shiptype', weight='$Weight', variable='$variable', invice_no='$Invoiceno',declarate='$Totaldeclarate', mode ='$Mode', pick_date='$Packupdate' , schedule='$Schedule',pick_time='$Pickuptime',book_mode='$Bookingmode',freight='$Totalfreight',
qty='$Qnty', shipping_subtotal='$shipping_subtotal', status='$status', comments='$Comments', officename='$officename', user='$user'
WHERE cid = '$cid'";
//echo $sql;
dbQuery($sql);

echo "<script type=\"text/javascript\">
alert(\"Updates applied successfuly.\");
window.location = \"admin.php\"
</script>";

//echo $Ship;
}//addcourier_update

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: Field 'user' doesn't have a default value

#2 andrewsw   User is offline

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,050
  • Joined: 12-December 12

Re: Field 'user' doesn't have a default value

Posted 07 March 2019 - 05:43 AM

Please wrap your code in code tags (you should have learnt how to do this by now).

Quote

The mysql extension is deprecated and will be removed in the future

It HAS been removed, you should not be using it. Besides, that is a (stern) warning, not necessarily an error.

You should also be using PARAMETERIZED QUERIES.

As a minimum debugging step you can print out the contents of the $_POST array to confirm that it contains what you think it contains.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1