I have a little problem whit this script

...................

$sql="INSERT INTO tranzactii (name, email) values 
('".$_POST['name']."','".$_POST['email']."')";
$result=mysql_query($sql);
$id_transaction=mysql_insert_id();

for ($i=0; $i < count($_SESSION['id_product']); $i++)
{
if ($_SESSION['nr'][$i] > 0)
{
$sql1="INSERT INTO sales values 
('".$id_tranzactie."','".$_SESSION['id_product'][$i]."','".$_SESSION['nr'][$i]."')";
mysql_query($sql1);
}
}
-------------------
The probem is that if i have more products only first id_product is insert into table 
sales. The rest id_product are inserted with 0.

How can I get over it?

Reply via email to