468,247 Members | 1,343 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

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 1499
do you mean this syntax?

<table>
<?
while ( $row = mysql_fetch_array($result) ) {

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

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

<table>
<?
while ( $row = mysql_fetch_array($result) ) {

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

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

-david-

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.

Cheers

May 30 '06 #4
or

mysql_fetch_array($result,MYSQL_ASSOC)

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

HIH

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
anfetienne
14 posts views Thread by anfetienne | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.