Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 php, insert data into table

views
     
TSNaqiudin
post Mar 18 2017, 12:42 AM, updated 8y ago

Getting Started
**
Junior Member
210 posts

Joined: Dec 2012



what i'm trying to do is to submit a form to a table , while the item that is selected from previous session cart is also added to the table ,
what i have now is based on trial and error , so far here is the coding , any sifu can help me ? thanks ! icon_rolleyes.gif
» Click to show Spoiler - click again to hide... «

SWsolutions
post Mar 18 2017, 02:04 AM

Getting Started
**
Junior Member
76 posts

Joined: Apr 2016
QUOTE(Naqiudin @ Mar 18 2017, 12:42 AM)
what i'm trying to do is to submit a form to a table , while the item that is selected from previous session cart is also added to the table ,
what i have now is based on trial and error , so far here is the coding , any sifu can help me ? thanks ! icon_rolleyes.gif
» Click to show Spoiler - click again to hide... «

*
it's better to state the error that u get. getting error populating frontend table or inserting into db table??

QUOTE
$result=mysql_query("insert into customers(column name??) values('','$name','$email','$address','$phone')");
$customerid=mysql_insert_id();
$date=date('Y-m-d');
$result=mysql_query("insert into orders(column name??) values('','$date','$customerid')");
$orderid=mysql_insert_id();
also sanitize ur data before sql stuff
cl.tech999
post Mar 18 2017, 07:21 AM

New Member
*
Junior Member
14 posts

Joined: May 2015
unset($_SESSION['cart']) after you insert data to the order_detail


QUOTE(Naqiudin @ Mar 18 2017, 12:42 AM)
what i'm trying to do is to submit a form to a table , while the item that is selected from previous session cart is also added to the table ,
what i have now is based on trial and error , so far here is the coding , any sifu can help me ? thanks ! icon_rolleyes.gif
» Click to show Spoiler - click again to hide... «

*

 

Change to:
| Lo-Fi Version
0.0121sec    0.39    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 10:15 PM