split query per $_POST???
| From: | Sancerni Veronica | Date: | Fri, 27 Aug 2004 06:12:56 +0000 |
| Subject: | split query per $_POST??? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-35911@lists.php.net to get a copy of this message | ||
Could anyone, please, help me with this one. If I add the insert inside the loop it inserts as many
orders in the order table as products have been chosen. There is really no way to split this?
I have a problem with a script that gets the ID's of the selected products from the previous
script and shows them with mysql_fetch_object. Now I'd like to insert them in the db, but when
I pass every value to $vars and insert them it inserts only one of the selected products. I tried a
change with mysql_fetch_array, with split and implode, ...useless. How can I get the products to be
apart without breaking the values, ie, put name of all the selected products in name field in the
db, put serial number of the selected products in serial field in the db, etc?:
...
while($isc = mysql_fetch_object($antw)){
if (!empty($isc->pic)) {
echo ("<img src='$isc->pic' width='50'><br>");
}
if (!empty($isc->Meas)) {
echo ("$isc->infMeas<br>");
}
if (!empty($isc->Name)) {
echo ("$isc->Name, ");
}
if (!empty($isc->Ref)) {
echo ("$isc->Ref,<br>");
}
$ipic = $isc->pic;
$iMeas = $isc->Meas;
$iName = $isc->Name;
$iRef = $isc->Ref;
}
...
$dem = "INSERT INTO orders
VALUES('$ipic','$iMeas','$iName','$iRef');
...
By the way how can I get them apart in the previous page by rows of 3 products each in the table?:
...
echo ("<table width=100% border=1 align=center cellspacing=0
cellpadding=5 bordercolor=#0000FF");
while ($inb = mysql_fetch_object($resultprd))
{
echo ("<tr><td width='20%'>");
if (!empty($inb->pic)) {
echo ("<img src='$inb->pic' width='200'><br>");
} else {
echo ("<img src='http://.../notaval.gif'
width='200'><br>");
}
if (!empty($inb->Type)) {
echo ("$inb->Type,<br>");
}
if (!empty($inb->Name)) {
echo ("$inb->Name<br>");
}
if (!empty($inb->Ref)) {
echo ("$inb->Ref<br>");
}
if (!empty($inb->Meas)) {
echo ("$inb->Meas<br>");
}
if (!empty($inb->Ref)) {
echo ("$inb->Ref<br>");
}
if (!empty($inb->Serial)) {
echo ("<strong>SERIAL N°: $inb->Serial</strong><br>");
}
if (!empty($inb->Description)) {
echo ("DETAILS: $inb->Description,<br>");
}
if (!empty($inb->Artw)) {
echo ("$inb->Artw,<br>");
}
if (!empty($inb->Cover)) {
echo ("$inb->Cover,<br>");
}
echo ("</td></table>");
---------------------------------
Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Créez votre Yahoo! Mail
Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer
instantanément avec vos amis.Téléchargez GRATUITEMENT ici !