infatti ho fatto cosi e funziona:
ti ringrazio molto, buona serata.codice:<ul> <li id="categories"> <h2>Galleria</h2> <ul> <?php $sql = "SELECT COUNT(*) FROM photo_categories"; if ($res = $db->query($sql)) { /* Check the number of rows that match the SELECT statement */ if ($res->fetchColumn() > 0) { /* Issue the real SELECT statement and work with the results */ $sql = "SELECT * FROM photo_categories ORDER BY byorder ASC"; foreach ($db->query($sql) as $row) { echo '<li><a href="photo_categories.php?id='.$row["id"].'">'.$row["title"].'</a></li>'; } } /* No rows matched -- do something else */ else { print "No rows matched the query."; } } ?> </ul> </li> </ul>
Ti puoi risparmiare una query. Come l'ho scritto prima il rowcount() agisce sul l'ultimo execute.
Ridatemi i miei 1000 posts persi !!!!
Non serve a nulla ottimizzare qualcosa che non funziona.
Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr
Volevo dire che per il test puoi usare $stmt->rowcount()
Ridatemi i miei 1000 posts persi !!!!
Non serve a nulla ottimizzare qualcosa che non funziona.
Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr