problem with db function php

This is a discussion on problem with db function php within the alt.comp.lang.php forums, part of the PHP Programming Forums category; hi echo '<table>'; $requete = mysql_query("SELECT liv_nolivre, sec_nosection, liv_commentaire, liv_titre FROM livre"); if ( mysql_num_rows($requete) != 0 ) { ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-28-2004
Marc Collin
 
Posts: n/a
Default problem with db function php

hi

echo '<table>';
$requete = mysql_query("SELECT liv_nolivre, sec_nosection,
liv_commentaire, liv_titre FROM livre");


if ( mysql_num_rows($requete) != 0 )
{
while ($requete = mysql_fetch_assoc($requete)) {
echo'<tr class="tabtitre"><td>'.$requete["liv_titre"].'</td></tr>',
'<tr><td>'.$requete["liv_commentaire"].' </td></tr>';
}
}
echo '</table>';

i get:


Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL
result resource

any idea?

maybe my echo is not good?
--
Borland rulez http://pages.infinit.net/borland
Reply With Quote
  #2 (permalink)  
Old 04-28-2004
Virgil Green
 
Posts: n/a
Default Re: problem with db function php

"Marc Collin" <os2@videotron.ca> wrote in message
news:8eGjc.69832$Tu2.1587055@weber.videotron.net.. .
> hi
>
> echo '<table>';
> $requete = mysql_query("SELECT liv_nolivre, sec_nosection,
> liv_commentaire, liv_titre FROM livre");
>
>
> if ( mysql_num_rows($requete) != 0 )
> {
> while ($requete = mysql_fetch_assoc($requete)) {


Here you replaced your result set with an array. $requete is being assigned.

- Virgil


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:28 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0