Jump to content

Need to seperate values from query result into variables


kshet26

Recommended Posts

I need to seperate the values contained in a query result into seperate variables. How would I go about doing this?

This is my query:

$result = mysql_query("SELECT DISTINCT Bug.ixBug, Bug.sTitle, Person.sFullName, Area.sArea, Bug.dtOpened, Bug.ixPriority, Bug.ixPersonAssignedTo FROM `Bug`, BugEvent, Person, Area WHERE Area.ixArea = Bug.ixArea AND Person.ixPerson=Bug.ixPersonAssignedTo AND Bug.ixBug =BugEvent.ixBug AND Bug.ixStatus=1 AND Bug.fOpen=1 AND Bug.ixPriority =1 AND (Bug.ixProject = 2 OR Bug.ixProject = 4)") or die(mysql_error());

I need to get the 7 values from each row of this query and seperate it into individual variables. I though about using a foreach() statement, but I could figure out how to do the value separation. I need them in seperate varibles so I output them to a file in specific places.
Link to comment
Share on other sites

What do you need? When you use mysql_fetch_* it will return you an array with the results, and they're organized enough for me.

[a href=\"http://www.php.net/mysql_fetch_assoc\" target=\"_blank\"]http://www.php.net/mysql_fetch_assoc[/a]
[a href=\"http://www.php.net/mysql_fetch_row\" target=\"_blank\"]http://www.php.net/mysql_fetch_row[/a]
[a href=\"http://www.php.net/mysql_fetch_array\" target=\"_blank\"]http://www.php.net/mysql_fetch_array[/a]

like:

[code]while ($row = mysql_fetch_assoc($result)) {
   $ixbug = $row['ixBug'];
   $area = $row['sArea]'
}[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.