Re: mysql - first element missing
| From: | Foong | Date: | Fri, 07 Mar 2003 08:31:22 +0000 |
| Subject: | Re: mysql - first element missing | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26157@lists.php.net to get a copy of this message | ||
i guess the problem is the last line of your Query function:
$this->ligne = @mysql_fetch_row($this->result);
this line fetch the first row of the result.
therefore, when you call afficheResultatRequete(...)
you start from the second row of the result.
Foong
"F.Collineau" <f.collineau@voila.fr> wrote in message
news:HBBPH2$B7523F15E7CBC78B31DA773D716DD863@voila.fr...
Hi,
I try to display the result of a mysql request but first element misses !
here is my code:
$sql->Query("select marque, reference from base );
$sql->afficheResultatRequete($sql->result,$sql->nbreChamps);
function Query ($query) {
$this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg
("Impossible
de lancer la requete: $query");
$this->rows = @mysql_num_rows($this->result);
$this->nbreChamps = @mysql_num_fields($this->result);
$this->ligne = @mysql_fetch_row($this->result);
}
function afficheResultatRequete($result,$nbChamps)
{
for($i=0 ; $row=mysql_fetch_row($result);++$i)
{
print("<tr>");
$this->color_tab($i);
for($j=0;$j<$nbChamps;$j++)
{
print "<td>"; print((string)$row[$j]); "</td>\n";
}
print "</tr>";
}
}
Whet is the problem ?
Thanks
Franck
------------------------------------------
Faites un voeu et puis Voila ! www.voila.fr