Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8815007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:16:06+00:00 2026-06-14T04:16:06+00:00

I have created a simple MYSQL database to store user information (id, FirstName, LastName)

  • 0

I have created a simple MYSQL database to store user information (id, FirstName, LastName)
and filled it with 3 names:

id | FirstName | LastName
1  | Sam       | Heyman
2  | Ben       | Eliott
3  | Al        | Readman

When I try and display the contents of the database in a table on my page, I get the correct number of rows but the cells are void.

User id | First Name | Last Name
        |            |
        |            |
        |            |

If I do

var_dump($rows) 

I get the following:

array(6) { [0]=> string(1) "1" ["id"]=> string(1) "1" [1]=> string(3) "Sam" ["FirstName"]=> string(3) "Sam" [2]=> string(6) "Heyman" ["LastName"]=> string(6) "Heyman" }

array(6) { [0]=> string(1) "2" ["id"]=> string(1) "2" [1]=> string(3) "Ben" ["FirstName"]=> string(3) "Ben" [2]=> string(6) "Eliott" ["LastName"]=> string(6) "Eliott" }

array(6) { [0]=> string(1) "3" ["id"]=> string(1) "3" [1]=> string(8) "Alastair" ["FirstName"]=> string(8) "Alastair" [2]=> string(7) "Readman" ["LastName"]=> string(7) "Readman" }  

So why are my cells empty? I have done many databases before and have never had this problem before. Having spent 3 hrs looking on google, I’ve given up.

This is the code:

<?php 
// Connect to server and select database.
$dbcnx = @mysql_connect('server','user','pw');
mysql_query('SET NAMES utf8;');
mysql_select_db('db', $dbcnx);
// Fetch all the users from the database
$users = @mysql_query('SELECT * FROM registered_users');
?>

<table width="400" border="1" cellspacing="0" cellpadding="3" style="color:red;">
<tr>
<th>User ID</th>
<th>First name</th>
<th>Last name</th>
</tr>   

<?php
// Start looping through the rows in mysql database.
while($rows=mysql_fetch_array($users)){
var_dump($rows);
echo"<br />";
?>

<tr>
<td><? echo $rows['id']; ?></td>
<td><? echo $rows['FirstName']; ?></td>
<td><? echo $rows['LastName']; ?></td>
</tr>

<?php
// close while loop
}
?>

</table>

<?php
// close MySQL connection
mysql_close();
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:16:07+00:00Added an answer on June 14, 2026 at 4:16 am

    Change

    <td><? echo $rows['id']; ?></td>
    <td><? echo $rows['FirstName']; ?></td>
    <td><? echo $rows['LastName']; ?></td>
    

    to either

    <td><?php echo $rows['id']; ?></td>
    <td><?php echo $rows['FirstName']; ?></td>
    <td><?php echo $rows['LastName']; ?></td>
    

    or

    <td><?= $rows['id']; ?></td>
    <td><?= $rows['FirstName']; ?></td>
    <td><?= $rows['LastName']; ?></td>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to design a MySQL database to store user zipcode preferences for providing
I have MySQL database, where I store the following BLOB (which contains JSON object)
I have to store hindi text in a MySQL database, fetch it using a
I have created a simple facebook app and I want to store the facebook
I have a simple php/mysql script that stores in mysql database id, link, and
Could someone help me on this, I have created simple web services using axis2
How to manually create Friendly URLs? (PHP) So I have created simple php file
I am new to Repository concept and get some questions. I have created simple
I have created the simple web service. Code: [ServiceContract] public interface ITsdxService { [OperationContract]
I have created this simple program to learn shared_ptr using namespace std; #define Yes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.