$addStmt = "Insert into $tableName1(order_no, username, item_no, quantity, date) values('%d','%s','%s','%d','%s')";
...statement to connect db....
//Execute the statement
if(!mysql_query(sprintf($addStmt,$order_no,$username,$item_no,$quantity,$date),$link))
{
DisplayErrMsg(sprintf("Error in executing %s stmt",$stmt));
DisplayErrMsg(sprintf("error:%d %s",mysql_errno ($link),
mysql_error($link)));
exit();
}
---------------------------------------------------------------------------------
($addStmt,$order_no,$username,$item_no,$quantity,$date),$link))
---------------------------------------------------------------------------------
Sorry ! i having troble again . the values i insert into db "date". can i use %s ?
and the statement here...table field can represent in $order_no ? or just put the field name "order_no" ?
i need help again... T.T
Moderator: General Moderators
yep u can use '%s' for date .
here u dont have to use table field name here u have to provide values to these fields here u have 2 use variables names doesnt matter .
Code: Select all
if(!mysql_query(sprintf($addStmt,$order_no,$username,$item_no,$quantity,$date),$link))