php - Output of the table in div class

683

$resultSet = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 7");
$product_count = mysql_num_rows($resultSet);
   if($product_count >0){

    while( mysql_fetch_array($resultSet)){
        $id= $row["id"];
        $cat= $row["categories"];
        $title= $row["title"];
        $image= $row["image"];
        $txt= $row["txt"];
        $res= $row["resource"];

        }
   }
     else  
        { echo'site is under maintaince ';}

       echo " <div class=\"row-fluid\">

     <div class=\"span6 post no-margin-left\">
      <figure>
       <img src=\"$image\" alt=\"Thumbnail 1\" />
       <div class=\"cat-name\">
        <span class=\"base\">'$cat'</span>
        <span class=\"arrow\"></span>
       </div>
      </figure>
      <div class=\"text\">
       <h2><a href=\"single_post.html\" title=\"$title\">'$title'</a></h2>
       <p>$txt</p>
       <div class=\"meta\">By <a href=\"$res\">' $res'</a>&nbsp;&nbsp;|&nbsp;&nbsp;'$date'&nbsp;&nbsp;|&nbsp;&nbsp;<a href=\"single_post.html\">15 comments</a></div>
      </div>
     </div>

       </div>";
   ?>

The code is not showing the output results of the table. Can you tell me what I am doing wrong? I want to show the output in the div class. My paging is working correctly, but it is not showing the output correctly. Can you guide me? I will really be grateful.

909

Answer

Solution:

while( mysql_fetch_array($resultSet)){
        $id= $row["id"];
        $cat= $row["categories"];
        $title= $row["title"];
        $image= $row["image"];
        $txt= $row["txt"];
        $res= $row["resource"];

        }
   }

Where is $row in the lopp? However, to populate all the results, you need the printing inside the loop, otherwise you won't get them iterated

People are also looking for solutions to the problem: php - How can we query mongodb array of Objects ids?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.