473,804 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_lo okup' 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 1748
do you mean this syntax?

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

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

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

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

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

You might want to use mysql_fetch_ass oc($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_arr ay($result,MYSQ L_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
3384
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 uses his own php shopping cart to receive customer orders. The configuration was done via cPanel with no external modifications - which produced no protests when built, ran and connected with no
3
1802
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' (quantity) cell with a default 0 The quantity can be altered. At the bottom of the table (form) is a submit to basket Button echo "<form action='basket.php' method='POST'>\n";
16
3502
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 in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
1
2245
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 locations ie Room1, Room2 etc The second represents locations within the rooms i.e Rack1, Rack2 etc
1
3219
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 following problem that I have encountered: The project entails ADDing ,EDITing, DELETing records from a web based database. However the main objective of this project is to allow users to perform queries on the data in the database and then view the...
15
449
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
5546
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 populate the <optionstag for a drop down menu and I cannot get it to work. Basically, there is a form on the website with a drop down box. I need the options in this box to be pulled from a preexisting table in a
5
1391
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 => 1000 ) And i Have written the following to compute first the difference betwenn the element.However my reference array can only be compare from the element of table i.e array. foreach($array as $i=>$value){
14
3771
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 with the locations of images, thumbnails and their corresponding captions. i want to populate the table like this: id image location thumbnail location caption 1 folder/image1.jpg folder/t/image1.jpg ...
14
4344
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. Ideally the user needs to make their selections, and enter the form into a new database table. The problem is, when the selection is entered into the new table, only the first word of the string is entered. For example, the drop down may have...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.