View Single Post
  #1 (permalink)  
Old July 11th, 2004, 08:40 PM
Tachyon Tachyon is offline
Authorized User
Points: 140, Level: 2
Points: 140, Level: 2 Points: 140, Level: 2 Points: 140, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Coeur d\'Alene, ID, USA.
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default getting a specific row from a MySQL result set

I'm having trouble getting my program to select a specific row from a MySQL result set. I know how to fetch the first row from a result set and I know how to print out the entire result set but that's about all I can do with it.

My situation is this: the program runs a query and grabs all the rows from a table (skill_info) where Joe has a listed skill. The result set has 3 rows and one of those rows is Joe's skill in carpentry. I want to grab that row and put it into $row[].

I thought of trying this:
Code:
mysql_data_seek ($result, 0);
    while ($row = mysql_fetch_array($result)){
    extract($row);
        if ($row['skillnum'] == "54"){
        exit;
        }
    }

but it exits the whole script/program when I only want to exit the loop.

Can anyone help? There must be a way to make mysql_fetch_array fetch only the row I want.

__________________
An overworked Web Developer who\'s expected to know everything yet given time to study nothing.
Reply With Quote