inserting array values to mysql with php on front end
$services_name=$_POST['services_name'];
$man_hour=$_POST['man_hour'];
$rate=$_POST['rate'];
$service_tax=$_POST['service_tax'];
$total=$_POST['total'];
$limit = count($services_name);
for($i=0;$i<$limit;$i++) {
$services_name[$i] = mysql_real_escape_string($services_name[$i]);
$man_hour[$i] = mysql_real_escape_string($man_hour[$i]);
$rate[$i] = mysql_real_escape_string($rate[$i]);
$service_tax[$i] = mysql_real_escape_string($service_tax[$i]);
$total[$i] = mysql_real_escape_string($total[$i]);
if($_POST['submit']=="Submit")
{
$qry="INSERT INTO invoice(`services_name`,`man_hour`,`rate`,`service_tax`,`total`) VALUES
('".$services_name[$i]."','".$man_hour[$i]."','".$rate[$i]."','".$service_tax[$i]."','".$total[$i]."')";
mysql_db_query($db,$qry)$change=mysql_insert_id();;
}
}
thi s my mysql code...
i am struck up with a mysql code where i need to enter array values to mysql.....now none of the data is entering to the db.
Subject
Written By
Posted
inserting array values to mysql with php on front end
June 11, 2012 12:48AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.