i have two code 1°
try{
// lancio di una transazione con PDO
$pdo->beginTransaction();
////
$results = $pdo->prepare("SELECT SUM(numconffattmiele) FROM dettconffattmiele WHERE codconffattmiele = '".$cod1conffattmiele."' AND boxfattmiele = '".$box1conffattmiele."' ");
$results->execute();
for($i=0; $rows = $results->fetch(); $i++){
$totnumconffattcodboxmiele1 = $rows['SUM(numconffattmiele)'];
echo $rows['SUM(numconffattmiele)'];
//exit;
}
}
// se qualcosa non è andato a buon fine
// blocco catch per la gestione delle eccezioni
catch(pdoException $e) {
///personalizzazione pagine di rientro
echo 'Attenzione: '.$e->getMessage();
// notifica in caso di errore
$output = "Impossibile collegarsi al Data Base, Utente o Password errati" . "<br>" . "<br>" . "prego riprovare" . $e .
"<br>" . "<br>" . "<a href='miele.php'>Clicca QUI per ritornare alla pagina principale</a>";
include 'errore.html.php';
// ritorno alla situazione precedente
$pdo->rollBack();
exit ();
}
2°
try{
// lancio di una transazione con PDO
$pdo->beginTransaction();
////
$results = $pdo->prepare("SELECT SUM(numconfmiele) FROM confmiele WHERE codconfmiele = '".$cod1conffattmiele."' AND boxconfmiele = '".$box1conffattmiele."' ");
$results->execute();
for($i=0; $rows = $results->fetch(); $i++){
$totnumconffattcodboxmiele1 = $rows['SUM(numconffattmiele)'];
echo $rows['SUM(numconffattmiele)'];
exit;
}
}
// se qualcosa non è andato a buon fine
// blocco catch per la gestione delle eccezioni
catch(pdoException $e) {
///personalizzazione pagine di rientro
echo 'Attenzione: '.$e->getMessage();
// notifica in caso di errore
$output = "Impossibile collegarsi al Data Base, Utente o Password errati" . "<br>" . "<br>" . "prego riprovare" . $e .
"<br>" . "<br>" . "<a href='miele.php'>Clicca QUI per ritornare alla pagina principale</a>";
include 'errore.html.php';
// ritorno alla situazione precedente
$pdo->rollBack();
exit ();
}
the code number 1 work the cod number 2 not ! the two code have just the mysql code difference but i try the second mysql code on phpmyadmin and works !! i also try different way php like:
*foreach($pdo->query("SELECT SUM(numconfmiele) FROM confmiele WHERE codconfmiele = '".$cod1conffattmiele."' AND boxconfmiele = ('".$box1conffattmiele."') ") as $row) {
echo "<tr>";
echo "<td>" . $row['SUM(numconfmiele)'] . "</td>";
echo "</tr>";
}
///////
foreach($pdo->query("SELECT SUM(numconffattmiele) FROM dettconffattmiele WHERE codconffattmiele = '".$cod1conffattmiele."' AND boxfattmiele = ('".$box1conffattmiele."') ") as $row) {
echo "<tr>";
echo "<td>" . $row['SUM(numconffattmiele)'] . "</td>";
echo "</tr>";
}*
and always the code call the table dettconffattmiele works and the code call the table confmiele not work..... the two tables have , for the required fields , the same values... parameters.... and the two table work on myisam.. i work on xamp.... some can help me please ? thanks... sorry for my english....