php - how to get output of this code. sometimes it shows output and sometime it doesnot? -


    <?php include 'config.php'; $tid = $_get['tid']; $sql="select topics tid='$tid'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?>  <div class="topics"><font size="4"><?php echo $rows['title']; ?></font></div><div class="tdm"><br/><center><img src="http://appricart.com/test/img/<?php echo $rows['photo']; ?>" height="100" width="100"/><br/> <small><?php echo $rows['message']; ?></small></div> <?php } include 'foot.php'; ?> 

sometime code works not please me problem.

it shows error

mysql_fetch_array() expects parameter 1 resource 

 <?php include 'config.php'; $tid = $_get['tid']; $sql="select topics tid='$tid'"; // here error $result=mysql_query($sql); 

you not selecting table topic. hence showing error..

$sql="select * topics tid='$tid'"; // better 

for more info visit mysql_fetch_array


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo