www.webdeveloper.com
Results 1 to 3 of 3

Thread: which is the best mysql fetch function to use...?

  1. #1
    Join Date
    Mar 2010
    Posts
    281

    which is the best mysql fetch function to use...?

    i want to select all the data from a single column in a table.
    ex:
    $q = 'select column_name from table';
    $result = mysql_query($q);

    what then is the best mysql fetch function to then use to then parse out the indiv columns?

    i'm so used to using "select *" and then using
    $row = mysql_fetch_array($result)
    $row[$i];
    etc etc.

    but i'd like to not select the entire table for this script i'm writing.

    thanks for any help with this.

  2. #2
    Join Date
    Dec 2005
    Posts
    2,984
    What I use most often is something like this:

    PHP Code:
    $result mysql_query("select ....");
    $somevar "";

    while(
    $row mysql_fetch_assoc($result)) {
      
    $somevar .= $row['myfieldname'];

    Hope that gives you the idea.
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...
    awesome.

  3. #3
    Join Date
    Mar 2010
    Posts
    281
    yes, thank you aj_nsc

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles