FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Group sort syntax?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Group sort syntax? [message #169795] Mon, 27 September 2010 04:27 Go to previous message
GarryJones is currently offline  GarryJones
Messages: 21
Registered: September 2010
Karma:
Junior Member
I have the following table from which I am reading with php.

ItemNumber, ItemName
349, bat
346, bat
346, bun
349, ball
417, hutch
350, jib
349, bridge
350, jig
346, ball
350, poll
350, numb

The Item numbers that someone wants to see are read into an array
called items.

If the array "items" contains is 346,349,350 (ie someone wants to see
everything except for item number 417

I need to be able to extract this data and group the items into a
table with table headings based on each value in the array

I think this gets the data for me

$sql = 'SELECT * FROM resmal
WHERE ItemNumber IN (' . implode(', ', $items) . ')';
$test=mysql_query($sql);

But how do I obtain this following result? I am unsure of the syntax.
I know how to write the html data but I need to be able to fetch the
data for each different item number in turn and group them,

ITEM NUMBER 346
bat
ball
bun

ITEM NUMBER 349
bat
ball
bridge

ITEM NUMBER 350
jib
jig
poll
numb

Any help Greatly appreciated
Garry Jones, Sweden
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: mysql_fetch_array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 15:36:25 GMT 2024

Total time taken to generate the page: 0.04309 seconds