View Full Version : need help with php echo statment

05-11-2009, 08:15 AM
Im currently trying to create a Alphabetical listing of a 800 member organization. Of course the single page woud be way to much info. I plan to make links to each letter and only display the information, listed and sorted by the last name. I cant seem to find any help on this, and I have tried everything I can think of. Here is a example of the A.php page that I want to display the members number, last name, first name, member number, address, phone, email.

<div id="heading">
<h1>A Listings</h1>
<div id="listings">
//Connect To Database

mysql_connect($hostname,$username,$password) OR DIE ('Unable to connect to database! Please try again later.');

$sql = "SELECT id, mem_number, first_name, last_name, street_address, city, state, zipcode, phone, email ";
$sql .= "FROM members ";
$sql .= "ORDER BY last_name ASC ";

$result = mysql_query($sql);

while($row = mysql_fetch_assoc($result)){

$id = $row['id'];
$id = $row['mem_number'];
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$street_address = $row['street_address'];
$city = $row['city'];
$state = $row['state'];
$zipcode = $row['zipcode'];
$phone = $row['phone'];
$email = $row['email'];

echo "<h3>$last_name=A, $first_name</h3>";
echo "<p>$mem_number</p>\n";
echo "<p>$street_address</p>\n";
echo "<p>$city $state $zipcode</p>\n";
echo "<p>Phone: $phone</p>\n";
echo "<em>Email: $email</em>\n";


</div><!--- listings--- >

05-11-2009, 08:26 AM
I took out you're sensitive info and added some PHP tags around that.

You don't need to make multiple pages for this. Instead, you use statements to determine what kind of data you need. Using the $_GET superglobal, you can build a condition for you're query based on the selected input character.

I'm not sure I understand what you're question is about the echo though. Could you clarify?