Jump to content

[SOLVED] Displaying data in the database


taz321

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.

Archived

This topic is now archived and is closed to further replies.

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