GIGJ.COM
welcome to my space
X
Search:  
Welcome to:gigj.com
NAVIGATION - HOME

why just one row?

Published by: rose 2008-11-20
  • I am trying to retrieve some info from mysql, but why would the below query return just one row?

    $postinfos = $DB_site->query("SELECT * FROM post WHERE award=1 and visible=1 ORDER BY dateline DESC");

    $award = array();

    while ($postinfo = $DB_site->fetch_array($postinfos))

    {

    exec_switch_bg();

    $postid = $postinfo['postid'];

    $tid = $postinfo['threadid'];

    $uid = $postinfo['userid'];

    $date = $postinfo['dateline'];

    $username = $postinfo['username'];

    $title = $postinfo['title'];
    Why NOT Apple - Apple iMac (MA199LL) Mac Desktop - with Front Row ::
    Apple iMac (MA199LL) Mac Desktop - with Front Row - User Rating: 5 stars. Review Summary: You dont have to be one outstanding idea. It just works.
    http://www.epinions.com/review/Apple_iMac_Front_Row_MA199LL_Mac_Desktop/content_238717931140
    HOME

    mysql_free_result($postinfos);

    }

    $threads = $DB_site->query("SELECT * FROM thread WHERE threadid=$tid");

    $threadid = array();

    while ($threadinfo = $DB_site->fetch_array($threads))

    {

    exec_switch_bg();

    $ttitle = $threadinfo['title'];

    $forums = $threadinfo['forumid'];

    mysql_free_result($threads);

    }

    $theforums = $DB_site->query("SELECT * FROM forum WHERE forumid=$forums");

    $forumid = array();

    while ($foruminfo = $DB_site->fetch_array($theforums))

    {

    exec_switch_bg();

    $forum = $foruminfo['title'];

    mysql_free_result($theforums);

    }


  • ok... can you tell me how to fix?


  • Because you keep overwriting the same data again and again and again.

    When you're in those while loops... assign the data you have to new parts of an array or something, but don't just change the value of static variables... you'll just overwrite what you did in the prior loop.





  • Nortel Unveils Vision, Strategy for Israeli High-Performance Net
    Busy Friday Leads to Strong Close for Net Stocks
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about why just one row? , Please add it free.

     Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 gigj.com        Site made:CFZ