Jump to content

Recommended Posts

Hi i was wondering if you can help me.

 

I am trying to display data i had inputted into the database and now want to display it.

 

I have been using the below code but its not showing me the data only the titles i created for each of them.

 

 

<?php

require "connect.php";

$query =  "select * from employee";

$result = @mysql_query($query, $connection)

or die ("Unable to perform query.<br />$query<br/>".mysql_error());

?>

 

<html>

<body>

<h1>List all People </h1>

 

<?php

while($row= mysql_fetch_array($result))

 

{?>

 

  EmployeeID : <?=$row['employeeID']?>  Title : <?=$row['title']?> FirstName : <?=$row['firstname']?>

 

Surname : <?=$row['surname']?> Username : <?=$row['username']?> Password : <?=$row['password']?>  <br/>

 

<?php } ?>

 

</body>

</html>

 

 

 

 

 

Is this code correct or am i missing some bits ?

 

Any help would be appreiciated.

Link to comment
https://forums.phpfreaks.com/topic/83040-solved-displaying-data-in-the-database/
Share on other sites

I see you use short tags. Please try to use full tags (as demonstrated by timmah1 above). Using full tags will allow your code to be more cross compatible with other PHP setups. Short tags are not enabled by default.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.