#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Columbus, OH 43212
    Posts
    4
    Rep Power
    0
    I'm just diving into the PHP/SQL thing and need some help. I've know ASP/Access well, but found this to be quite different and little more complex, though all for good reasons I'm sure

    I successfully, made a DB and table and columns, etc. - and got a form to enter data into the table. There is an auto-increment ID number, which is fine - I think.

    Right now there are 14 items in the table (1-14) and when I SELECT * and display with mysql_fetch_array, it only displays the rows with even ID numbers. Here's what I have to pull the info.

    $sql = "SELECT * FROM articles";
    $result = mysql_query($sql);

    while ($myrow = mysql_fetch_array($result)) {

    $myrow = mysql_fetch_array($result);

    echo $myrow["ArticleID"];
    echo $myrow["Headline"];
    echo "<br>";
    echo $myrow["Article"];
    echo "<p>";
    }

    I came up with all that from various help/tutorials I found online. It displays the info great, but only even-numbered rows. And when I through a DESC in the SELECT it showed the odd-number rows - eitherway, I can't figure out how to just have it show all the results in order, even & odd.

    Any help is greatly, greatly appreciated.


    ------------------
    ---
    Thanks.
    ~Moog

    http://www.moogman.com
    http://www.caveradio.com
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    2
    Rep Power
    0
    Hey,

    I think your problem has to do with your use of mysql_fetch_array.

    I was working on some stuff last night ( which worked ) and it looked more like this.

    while ( $column = mysql_fetch_array ( $sql_result)
    $f_name = $column[f_name];
    $desc = $column[desc];
    echo "<tr><td>$f_name</tr></td><td>$desc</td>";

    So, I think you have to break the mysql_fetch_array into rows( columns, whatever ) before it can be used properly.

    Bear in my I am a complete newb. Perhaps it'll help. Good luck.

    Rumpy.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    32
    Rep Power
    14
    You just have to get rid of the line:

    $myrow = mysql_fetch_array($result);

    You're already assigning and incrementing in the while statement.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Columbus, OH 43212
    Posts
    4
    Rep Power
    0
    Thanks to you both. I'll give the ideas a whirl and see what happens.
    Thanks again!
    ~Moog

Similar Threads

  1. Showing number of results from coloum
    By riotx in forum PHP Development
    Replies: 1
    Last Post: December 29th, 2003, 07:30 PM
  2. Using sessions for search / results pages
    By Quirk in forum PHP Development
    Replies: 10
    Last Post: December 15th, 2003, 08:36 PM
  3. Replies: 1
    Last Post: December 4th, 2003, 08:57 PM
  4. Limit results on 'left join' query
    By tippiedog in forum MySQL Help
    Replies: 1
    Last Post: November 12th, 2003, 07:58 AM
  5. How to write a FTP request
    By ericmar in forum FTP Help
    Replies: 4
    Last Post: October 3rd, 2003, 07:45 PM

IMN logo majestic logo threadwatch logo seochat tools logo