taz321 Posted December 24, 2007 Share Posted December 24, 2007 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 More sharing options...
timmah1 Posted December 24, 2007 Share Posted December 24, 2007 I'm sure you have to echo the rows out <?=$row['employeeID']?> <?php echo $row['employeeID'];?> Link to comment https://forums.phpfreaks.com/topic/83040-solved-displaying-data-in-the-database/#findComment-422368 Share on other sites More sharing options...
taz321 Posted December 24, 2007 Author Share Posted December 24, 2007 Excellent Thank you very much, it now works. Link to comment https://forums.phpfreaks.com/topic/83040-solved-displaying-data-in-the-database/#findComment-422371 Share on other sites More sharing options...
wildteen88 Posted December 24, 2007 Share Posted December 24, 2007 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. Link to comment https://forums.phpfreaks.com/topic/83040-solved-displaying-data-in-the-database/#findComment-422373 Share on other sites More sharing options...
revraz Posted December 24, 2007 Share Posted December 24, 2007 Yep, you were echo'ing them, but you used the short version instead. Link to comment https://forums.phpfreaks.com/topic/83040-solved-displaying-data-in-the-database/#findComment-422376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.