Skip navigation
mikeavery333123
Currently Being Moderated

Why is the name not being displayed?

Apr 17, 2012 10:14 PM

I am trying to display the firstname from my mysql database after someone has logged in. It was working earlier but my login seemed to only be working 50% of the time. It now works 100% but does not display a name like "Welcome, Mike" like I want it to, it just says "Welcome, "

 

Any help would be great.

 

 

<<<<<<<<<CODE>>>>>>>>

 

...

 

 

<li style="color:white;">Welcome,

 

                                                            <?php

                        // Connect to database server

                        include_once '../../mysql_server/connect_to_mysql.php';

 

                                                            error_reporting(E_ALL);

                                                            ini_set('display_errors', '1');

 

 

                              $id = isset($_SESSION['id']);

                        // SQL query

                        $strSQL = "SELECT * FROM myMembers WHERE ID = '$id'";

                   

                        // Execute the query (the recordset $rs contains the result)

                        $rs = mysql_query($strSQL);

                       

                        // Loop the recordset $rs

                        // Each row will be made into an array ($row) using mysql_fetch_array

                        while($row = mysql_fetch_array($rs)) {

                   

                           // Write the value of the column FirstName (which is now in the array $row)

                         echo $row['firstname'];

                   

                          }

                   

                        // Close the database connection

                        mysql_close();

                        ?>

     

                </li>

                <li><a href="../../logout.php">Logout</a></li>

 

 

<<<<<<CODE>>>>>>>>>

 
Replies
  • Currently Being Moderated
    Apr 18, 2012 7:05 AM   in reply to mikeavery333123

    $id = isset($_SESSION['id']);

    This tells me that there is or is not a value for $_SESSION['id'], it returns true or false but not the value of the session.

     

    Gramps

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points