function mysql_fetch_all($result) { $all = array(); while ($all[] = mysql_fetch_assoc($result)) {} return $all; }
class Q {
function Q($requete) {
global $debug,$connexion;
if ($debug == '1') $this->debug = 1;
if ($this->debug == '1') db($requete);
$this->nb = 0;
$this->V = array();
$req = mysql_query($requete,$connexion) or die('Impossible d\'exécuter la requête : '.mysql_error($connexion));
if (!@mysql_num_rows($req) || @mysql_num_rows($req) < 1) return;
else {
$this->nb = mysql_num_rows($req);
while ($res = mysql_fetch_assoc($req)) {
foreach ($res as $titre=>$value) $this->V[][$titre] = $value;
}
}
@mysql_free_result($req);
}
}
$S =& new Q(" SELECT * FROM galeries WHERE id='$galerie_id' LIMIT 0,10 ");
for ($i=0; $i<$Q->nb; $i++) echo $Q->V[$i]['titre'];
You need to create an account or log in to post comments to this site.