Jump to content

Archived

This topic is now archived and is closed to further replies.

rscott7706

Creating Columns using PHP

Recommended Posts

Hello, as in many cases, brand new to MYSQL and PHP.

I have a 119 record MYSQL that I am querying through PHP. I would like to display as three columns.

Here is some of the code, is there a way to use this code then disply as three equal columns?

<?php
$db = mysql_connect("localhost", " ", " ");
mysql_select_db(" ");
$query = "SELECT * FROM members";

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){
echo $row['Company_Name'];
echo "<br />";
echo "Contact: ";
echo $row['First_Name'] . " ". $row['Last_Name'];
echo "<br />";
echo $row['Mailing_Address'];
echo "<br />";
echo $row['Mailing_City']. ", ". $row['Mailing_State']. " ". $row['Mailing_Zip_Code'];
echo "<br />";
echo "Phone: ";
echo $row['Phone_Number'];
echo "<br />";
echo "Fax: ";
echo $row['Fax_Number'];
echo "<br />";
echo "<br />";
}
?>

Thanks in advance!

Ron Scott

Share this post


Link to post
Share on other sites
Hey Ron, it appears you have around 5 items (Company Name, Name, Mailing Address, Phone Number, Fax Number). Do each of these items deserve their own column? Basically, I am asking what the column header names should be?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.