la verdad es que he posteado el codigo pero..... el codigo es este:
Código PHP:
require("connect.php");
session_start();
$nombre=explode(" ",$_POST["nombre"]);
$nombres=$nombre[0];
$descuento=$_POST["descuento"];
$modo_pago=$_POST["modo_pago"];
$pago=$_POST["pago"];
$n_cheques=$_POST["n_cheques"];
$total=$_POST["total"];
$select_rut="select rut from clientes where nombres='$nombres'";
$resp_rut=mysql_query($select_rut,$link);
$rows_rut=mysql_fetch_array($resp_rut);
$rut=$rows_rut["rut"];
$select_num="select id from boletas order by id desc";
$resp_num=mysql_query($select_num,$link);
$rows_num=mysql_fetch_array($resp_num);
$n_boleta=$rows_num[0]+1;
if (isset($itemsEnCesta)){
foreach($itemsEnCesta as $k => $v){
$titulo=$k;
$cantidad=$v;
$string_cod="select id,codigo from libros where titulo= '$k'";
$resp_cod=mysql_query($string_cod,$link);
$rows_cod=mysql_fetch_array($resp_cod);
$cod_lib=$rows_cod["codigo"];
$id_lib=$rows_cod["id"];
echo $id_lib;
$string_pre="select precio from datos_libros where id='$id_lib'";
$resp_pre=mysql_query($string_pre,$link);
$rows_pre=mysql_fetch_array($resp_pre);
$precio=$rows_pre["precio"];
$string="insert into boletas(id,id_lib,cantidad,precio,rut,total,descuento,modo_pago,cheques)values('$n_boleta','$cod_lib','$cantidad','$precio','$rut','$total','$descuento','$pago','$n_cheques')";
$resp=mysql_query($string,$link);
}
session_destroy();
echo"<a href='../index_ventas.php'>volver a compras</a>";
}
es el mismo que habia posteado el otro dia pero lei manuales vi los fqs y no he podido saber porque no esta guardando todos los datos y solo uno.