This the easy php code I'm using to see items in a forum. The issue is , it's working fine in a single of my laptop however in second it don't show the output.

  // Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
<td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>

while($rows=mysql_fetch_array($result)){ // Start looping table row
<td bgcolor="#E6E6E6"><? echo $rows['id']; ?></td>
<td bgcolor="#E6E6E6"><a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#E6E6E6"><? echo $rows['view']; ?></td>
<td align="center" bgcolor="#E6E6E6"><? echo $rows['reply']; ?></td>
<td align="center" bgcolor="#E6E6E6"><? echo $rows['datetime']; ?></td>

I checked anything else plus they appears fine. Information is contained in the database however the it isn't showing in forum. Can anybody assist me to within this? operating sys : win7

time for you to learn debugging, friend.

Good starting point:

for mysql it's very handy to operate queries by doing this:

$result=mysql_query($sql) or trigger_error(mysql_error()." ".$sql);

and make certain you can observe all errors happened. if you cannot as a fast fix you can include wrinkles towards the top of the script


as well as the production condition display_errors value ought to be transformed to

It's also sound practice to check on HTML source rather than watching made page within the browser. It will explain for those who have any difficulty with short tags or otherwise. It certainly is good to understand for those who have any difficulty prior to going to repair it.

you need to use

<?php echo $rows['id']; ?> rather than <? echo $rows['id']; ?>

short tag might be disabled.