Displaying Multidimensional Arrays...about to put my head in a vice, PLEASE HELP


Posted on 16th Feb 2014 07:03 pm by admin

I am fairly new to PHP and MySQL and I have a problem which I have been trying to resolve for days. I just can't figure it out and can't find anything on the web that is helping me work it out.

I hope someone out there can assist.

Ultimately I want to display the data as follows (this is just an example of how I want it displayed, it does not mirror the data set below)...

<h2><a href="procedure.php?number=f1>Finance Procedure 1 - F1</a></h2>
<ul>
<li><a href="form/f1_fm1.pdf" target="blank">Finance Form 1</a></li>
<li><a href="form/f1_fm2.pdf" target="blank">Finance Form 2</a></li>
<li><a href="form/f1_fm3.pdf" target="blank">Finance Form 3</a></li>
</ul>

<h2><a href="procedure.php?number=f2>Finance Procedure 2 - F2</a></h2>
<ul>
<li><a href="form/f2_fm1.pdf" target="blank">Finance Form 1</a></li>
<li><a href="form/f2_fm2.pdf" target="blank">Finance Form 2</a></li>
<li><a href="form/f2_fm3.pdf" target="blank">Finance Form 3</a></li>
</ul>

<h2><a href="procedure.php?number=f3>Finance Procedure 3 - F3</a></h2>
<ul>
<li><a href="form/f3_fm1.pdf" target="blank">Finance Form 1</a></li>
<li><a href="form/f3_fm2.pdf" target="blank">Finance Form 2</a></li>
<li><a href="form/f3_fm2.pdf" target="blank">Finance Form 3</a></li>
</ul>

I have 2 tables (procedure_name and procedure_form). and run the following query which gives me the required data set.

$sql = "SELECT procedure_info.id, procedure_info.name, procedure_info.number, procedure_form.form, procedure_form.form_file
FROM procedure_info
LEFT JOIN procedure_form ON ( procedure_info.id = procedure_form.name_id )
WHERE procedure_info.procedure_area = '14'
ORDER BY procedure_info.procedure_area ASC";

My problem is that I don't know how to output the result set I achieve into the exampled display. my data set looks like this.

id ---name ------------------------------number --form ---------------------form_file

33 ---Referral ---------------------------E2E1 ----NULL ----------------------NULL
34 ---Employer led E2E referral -----------E2E1a ---NULL ----------------------NULL
35 ---Centre Start & Induction -----------E2E2 ----NULL ----------------------NULL
39 ---Programme activity plan & review ---E2E4 ----NULL ----------------------NULL
38 ---Inital Assessment ------------------E2E3 ----Additional Information ------e2e2_fm4.pdf
38 ---Inital Assessment ------------------E2E3 ----E2E Weekly Batch Header ---mi1_fm2.pdf
40 ---Placement -------------------------E2E5 ----NULL ----------------------NULL
41 ---E2E Health & Safety review ---------E2E5a ---NULL ----------------------NULL
42 ---E2E Health & Safety Monitoring -----E2E5b ---NULL ----------------------NULL
43 ---E2E Basic skills ---------------------E2E6 ----NULL ------------------------NULL
44 ---Leavers ----------------------------E2E7 ----NULL ----------------------NULL

I think I have to put this data into a multidimensional array but I just can not work it out.

Can anyone help me? PLEASE!!!

No comments posted yet

Your Answer:

Login to answer
168 Like 29 Dislike
Previous forums Next forums
Other forums

Converting RGB values to HEX
Code: <?PHP

$file_handle = fopen("colors/rgb.csv", "r");

wh

ereg_replace in Wordpress
Heya - so I'm working on this site: http://world-of-smiles.theportlandco.com/new-patients

The

mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My

please help me... my password gets encrypted but not able to get in database
hai guys,
please help me... in the following function my password gets encrypted but no

Help with file_get_html
The following code gives the expected results:

<html>
<head&g

this code is not working????
it says this error.. Warning: Division by zero in ..

the variables are correct, so why is th

Function
How can I make this function that once you click the link in the code it takes you to a new page wit

How to Create a Dynamic table
col1 col2 date1 date2 date3 date4..........
a b v1 v2 v3 v4

Storing Values taken from a DB...
Using this code it will generate a short list from my database

<?php
mysql_connect

i want run some web server under the ip sharer
hello i want run some web server under the ip sharer
my ip is floating ip but it doesnt matter

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash