-3
$sql_blog = "SELECT description FROM blog WHERE status = 'Active' ORDER BY blog_id ASC";
    $rs_blog = mysql_query($sql_blog);
$id = 1;
    while($row = mysql_fetch_array($rs_blog)){

HTML

<div id="content1" class="tabscontent">
Test 1            
</div>
<div id="content2" class="tabscontent">
Test 2 
 </div>
<div id="content3" class="tabscontent">
Test 3           
</div>
 <div id="content4" class="tabscontent">
Test 4           
</div>
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • 3
    Please, [don't use `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php), They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) instead, and use [PDO](http://us1.php.net/pdo) or [MySQLi](http://us1.php.net/mysqli). [This article](http://php.net/manual/en/mysqlinfo.api.choosing.php) will help you decide. – Jay Blanchard Oct 22 '14 at 13:38

1 Answers1

0
$sql_blog = "SELECT id, description FROM blog WHERE status = 'Active' ORDER BY blog_id ASC";


while($row = mysql_fetch_array($rs_blog)): ?>
   <div id="content<?php echo $row['id']; ?>">
      <?php echo $row['description']; ?>
   </div>
<?php endwhile; ?>

I think this is what you are looking for.

David
  • 3,831
  • 2
  • 28
  • 38
  • Sorry, It's not working properly. Anyone please help for below this code: Please check below code: $sql_blog = "SELECT blog_id, description FROM blog WHERE status = 'Active' ORDER BY blog_id ASC"; $rs_blog = mysql_query($sql_blog); $blog_id = 1; while($row = mysql_fetch_array($rs_blog)){ $blog_id = $row['blog_id']; ?>
    =stripslashes($row['description']) ?>
    } ?>
    – Tuhina Pradhan Oct 24 '14 at 06:11