SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,027
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Strage Strange ERROR - does not print out the 1st row

    Hi,

    We are getting a very strange ERROR!

    We have a MySQL Query which returns 5 rows, as you can see from:

    echo '<p>Num Rows: ' . mysql_num_rows($query_get_blogs);

    and it prints 5.

    And btw of course we have ran the MySQL SELECT command that is to return this list in the MySQL query
    browser and we see that it returns 5 rows.

    But when we go to print out these rows on the Web page, it DOES NOT print out the 1st row and instead
    it prints out 4 rows!!!

    That is this Php command is printing out only 4 rows whereas there are 5 rows in the list:

    while ($result_get_blogs = mysql_fetch_array($query_get_blogs)) {

    ++$num;
    $blog_id = $result_get_blogs['blog_id'];

    ?>
    <tr bgcolor="#ffffff">
    <td align="left">
    <?php echo $num; ?>
    </td>
    <td align="left" colspan="6">
    <?php echo $blog_id; ?>
    </td>
    </tr>
    <?php
    }
    ?>

    What the HEK is going on that it is not printing our the 1st row!

    ThanX,

    Anoox search engine volunteer

    www.anoox.com

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,807
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    Check to see if you are ever calling mysql_fetch_array($query_get_blogs) prior to your while loop, or calling mysql_fetch_assoc($query_get_blogs) prior to your while loop
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  3. #3
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,027
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yes, that was the problem.
    By some strange Osmosis there was a call to mysql_fetch_array($query_get_blogs) before the while loop!
    Cant believe we missed that!
    Thanx for your budge.

    Have a great day

    Quote Originally Posted by cpradio View Post
    Check to see if you are ever calling mysql_fetch_array($query_get_blogs) prior to your while loop, or calling mysql_fetch_assoc($query_get_blogs) prior to your while loop

    Anoox search engine volunteer

    www.anoox.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •