Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2007
    Posts
    3

    Unanswered: fetching from mysql using php

    hi guys i have a small problem and that is i want to display recods from data base like what is shown in the flowing link

    http://www.amazon.com/b/ref=amb_link...8&node=1069242
    plz provid me an example with code

    thanks in advance

  2. #2
    Join Date
    Mar 2007
    Posts
    24
    Have a look at the mysql_fetch_array() function.

  3. #3
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    My preference is the mysql_fetch_assoc() so you can utilise names instead of numbers (which semantically don't mean anything).

    e.g.
    Code:
    while($row= mysql_fetch_assoc($results,$mysql_conn)){
       $data['ID'] = $row['ID'];
       $data['name'] = $row['name'];
    }
    The $row[value] bits above are the names of the columns that are in your database (or the aliases used in your SQL statement).

  4. #4
    Join Date
    Mar 2007
    Posts
    24
    I use the associative index names as well, which mysql_fetch_array() gives you (along with the numeric indices).

Posting Permissions

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