Display Data from mySQL Across and then Down
Display Data from mySQL Across and then Down
(OP)
Hi,
On our fire department website we would like to add a page of pictures of our personnel. I am against adding names of our personnel directly into the html code so I have a mySQL database with their name, position, email address, and image file. I am using php to pull the data out and display it on our page. Here is a draft of the code I have so far:
Right now the data displays one row per person. I am looking to display 4 pictures across with name, position, and email address below each picture. Then, the next row will display the next 4 pictures across with name, position, and email address below each picture, etc...
How can I get the data to display across and then down???
Thanks,
Tammy
On our fire department website we would like to add a page of pictures of our personnel. I am against adding names of our personnel directly into the html code so I have a mySQL database with their name, position, email address, and image file. I am using php to pull the data out and display it on our page. Here is a draft of the code I have so far:
CODE --> php
<html> <body> <?php //Get data from database and display in HTML table $con = mysql_connect("localhost","mukwona2_Mfd3400","1913mfd!"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mukwona2_contacts", $con); $result = mysql_query("SELECT * FROM email_address ORDER BY Nbr"); echo "<table> <tr> <th>Nbr</th> <th>LName</th> <th>FName</th> <th>Email</th> <th>Position</th> <th>Picture</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Nbr'] . "</td>"; echo "<td>" . $row['LName'] . "</td>"; echo "<td>" . $row['FName'] . "</td>"; echo "<td>" . $row['Email'] . "</td>"; echo "<td>" . $row['Position'] . "</td>"; echo "<td><img src=" . $row['Headshot'] . " height='200' width='150'></td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </body> </html>
Right now the data displays one row per person. I am looking to display 4 pictures across with name, position, and email address below each picture. Then, the next row will display the next 4 pictures across with name, position, and email address below each picture, etc...
How can I get the data to display across and then down???
Thanks,
Tammy
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
RE: Display Data from mySQL Across and then Down
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: Display Data from mySQL Across and then Down
THANKS!
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
RE: Display Data from mySQL Across and then Down
CODE
-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
RE: Display Data from mySQL Across and then Down
The style police will be knocking your door down, using tables for tabular data indeed! :)
People will be thinking that's the right way to do things.
Anyhow!
Here's one I prepared earlier,
bookemdanno.com (I only built the WP template around an existing design)
And Chris Coyier on Floats
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: Display Data from mySQL Across and then Down
Thanks!!!
CODE --> php
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
RE: Display Data from mySQL Across and then Down
CODE
CODE
ps. I have a broadly similar layout at http://www.leicesteryha.org.uk/slideshows/ if you want to see a working example.
-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd