Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help with php echo statment

    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.

    PHP Code:
    <div id="heading">
                    <h1>A Listings</h1>
                </div>
           <div id="listings">
                    <?php
                        
    //Connect To Database
                            
    $hostname='**********';
                            
    $username='**********';
                            
    $password='**********';
                            
    $dbname='***********';
                            
    $usertable='members';
                            
                                
    mysql_connect($hostname,$username,$password) OR DIE ('Unable to connect to database! Please try again later.');
                                
    mysql_select_db($dbname);
                            
                            
    $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--- >
    Last edited by Fou-Lu; 05-11-2009 at 07:17 AM. Reason: Added PHP tags, removed sensitive info

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    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?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •