473,372 Members | 1,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 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 1728
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
3
by: Stephen Preston | last post by:
I can't get an $array to be used as a select query on a mySQL database. I have a 'parts list' which displays on a page (works fine) and is a form. At the end of each row is a input type='text'...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
1
by: Stephene | last post by:
New to the world of web design/php/mysql and need help please. What I'm trying to do: I would like a web page with three drop down menus each populated by a query The first represents...
1
by: kurty | last post by:
Hello all, I am currently working on a project (a web based database) which entails the use of HTML, PHP and MySQL. I am new to all of these languages and would like some assistance in solving the...
15
by: TKirahvi | last post by:
Why can't I create Objects in an Array within for/while loop? If I have: Code: $galleries = array(); while( $db->next_record() ) {
6
by: cresh | last post by:
Hello everyone, I have a problem that I cannot seem to figure out. If any of you have an answer or suggestion, I would appreciate it. My HTML/PHP code needs to pull options from a database to...
5
by: poreko | last post by:
Hi guys I am trying to compare every row of mysql database against an array. My aim is to compute the euclidean distance. This is my reference array: Array ( => 2.5 => 120 => 128 => 2 =>...
14
anfetienne
by: anfetienne | last post by:
hi this question is linked to this post ive made in the mysql section. http://bytes.com/topic/mysql/answers/871536-populating-table#post3499253 simply i want to use a form to populate a table...
14
by: Philth | last post by:
Hi there, I've essentially got a form with several drop down, each populated by columns in various tables. The populating bit works fine - the column rows appear as they should in the menu. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.