Skip navigation
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.








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



                        // Connect to database server

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



                                                            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





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




  • 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.



    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