Populating arrays from MySQL query

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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.

Re: Populating arrays from MySQL query

do you mean this syntax?

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

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

Re: Populating arrays from MySQL query

strawberry wrote:
Quoted text here. Click to load it
You might want to use mysql_fetch_assoc($result) here since you are  
fetching the results by column name only.


Re: Populating arrays from MySQL query



Re: Populating arrays from MySQL query

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?

Re: Populating arrays from MySQL query

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


Re: Populating arrays from MySQL query

I'm not totally sure what you are mean.

Perhaps if I show you the problem
(http://www.houseoftype.co.uk/intershoe/lab/demonstration.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.


Site Timeline