Ragazzi dovrei prendere dei dati estratti da una tabella, alcuni record e inserirli in un altra, ho usato il clclo ma penso di aver fatto una gran cavolata, vi posto il codice e vi dico , l'errore, grazie sempre per le risposte in anticipo.
Faccio praticamente, : estraggo i dati da una tabella, poi da un altra però in un ciclo e poi insert (ho provato con un solo prodotto, e funziona ma da un errore, penso che la logica che ho usato sia errata, qualcuno mi può aiutare?codice:$db->Query("SELECT affiliato.*, ordini.*, utenti.* FROM affiliato, ordini, utenti WHERE affiliato.idAffiliato = {$_REQUEST['idAffiliato']} AND affiliato.idAffiliato = ordini.idAffiliato ORDER BY idOrdine DESC LIMIT 1 "); $ordine=$db->Row(); $db->Query("SELECT carrello.* , affiliato.* FROM affiliato, carrello WHERE affiliato.idAffiliato = {$_REQUEST['idAffiliato']} AND affiliato.idAffiliato = carrello.idAffiliato"); while($carrello=$db->Row()){ echo $car['idProdotto'] = MySQL::SQLValue($carrello->idProdotto); echo $car['qnt'] = MySQL::SQLValue($carrello->quantita); echo $car['codOrdine'] = MySQL::SQLValue($ordine->idOrdine); if(! $db->InsertRow("codOrdine",$car)) echo $db->Kill(); } $filter['idAffiliato'] = MySQL::SQLValue($_REQUEST['idAffiliato'], MySQL::SQLVALUE_TEXT); if(! $db->DeleteRows("carrello",$filter)) echo $db->Kill();
corrispondente a questa riga ;codice:'2''1''12' Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, boolean given in /web/htdocs/www.freestyleweb.it/home/progetti/centro2/Adminware2.0/inc/mysql.class.php on line 1299
Come posso fare? grazie a tutticodice:public function Row($optional_row_number = null) { $this->ResetError(); if (! $this->last_result) { $this->SetError("No query results exist", -1); return false; } elseif ($optional_row_number === null) { if (($this->active_row) > $this->RowCount()) { $this->SetError("Cannot read past the end of the records", -1); return false; } else { $this->active_row++; } } else { if ($optional_row_number >= $this->RowCount()) { $this->SetError("Row number is greater than the total number of rows", -1); return false; } else { $this->active_row = $optional_row_number; $this->Seek($optional_row_number); } } $row = mysqli_fetch_object($this->last_result); if (! $row) { $this->SetError(); return false; } else { return $row; } }

Rispondi quotando
per il resto il ciclo è corretto cosi?
