471,072 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,072 software developers and data experts.

Populating arrays from MySQL query

I wonder if anyone out there can help me.

I have the following code: http://pastebin.com/746601

The field 'material' in 'is_material' contains multiple values for each
record in 'is_details'. Because of this I have used
'is_material_lookup' as a reference lookup table containing the
'style_code' and 'material_code' which refer to their full details in
the respective tables.

Currently I have got the script outputting all the details and one
material then in the next block of data, repeating the details with a
different material. What I would like to achieve is having 1 block of
data with a list of all materials in that, instead of the repeat, but
sadly I can't know exactly how to do it.

Thank you for help in advance.

May 30 '06 #1
6 1608
do you mean this syntax?

while ( $row = mysql_fetch_array($result) ) {

echo "<tr>$row['fieldname']</tr>\n";

May 30 '06 #2
strawberry wrote:
do you mean this syntax?

while ( $row = mysql_fetch_array($result) ) {

echo "<tr>$row['fieldname']</tr>\n";

You might want to use mysql_fetch_assoc($result) here since you are
fetching the results by column name only.


May 30 '06 #3
I'm not totally sure what you are mean.

Perhaps if I show you the problem
(http://www.houseoftype.co.uk/intersh...onstration.php) it might
help understanding in general.

As yo ucan see from the link above, the first 2 blocks of data are the
same bar the material. What I want is those blocks merged so that it
shows the list of materials rather than just one.


May 30 '06 #4


May 30 '06 #5
I think i need to add a further loop where the material information
goes. But whenever I try to access /build one, it keep erroring.

Any ideas?

May 30 '06 #6
I can only suggest that you take a look at the examples given towards
the bottom of the page at this http://uk2.php.net/mysql_fetch_array


May 30 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Stephen Preston | last post: by
1 post views Thread by Stephene | last post: by
15 posts views Thread by TKirahvi | last post: by
6 posts views Thread by cresh | last post: by
5 posts views Thread by poreko | last post: by
14 posts views Thread by anfetienne | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.