mysql - My PHP Scripts returns only one row from my table -


i got problem while i'm trying retrieve data db!

here's parsing code i've included & data mysql table:

$select_posts = "select * posts order rand() limit 0,6"; $run_posts = mysqli_query($con,$select_posts); while($row=mysqli_fetch_array($run_posts)){     $post_id = $row['post_id'];     $post_title = $row['post_title'];     $post_date = $row['post_date'];     $post_author = $row['post_author'];     $post_image = $row['post_image'];     $post_keywords = $row['post_keywords'];     $post_content = $row['post_content'];     $post_summary = $row['post_summary']; } 

as can see add limit 0,6 means "starts 1st row & show 6 items table"...

but don't know why 1 result appears.

this page show results of table:

<div id="box">                 <div class="bjadidbold">                 <?php                  if (mysqli_num_rows($run_posts) > 0){                      echo "                     <h1>$post_title</h1>                     <p>$post_summary</p></br>                     <a style='float:right;font-size:30px;margin-top:-30px;' href='blog_post_content.php?post_id=$post_id'>readmore</a>                     ";                 }else{                     echo "<h1>no posts yet!</h1>";                 }                 ?>                 </div>             </div> 

i want show @ least 6 items on page. how can able that?

change first block not overwrite:

$select_posts = "select * posts order rand() limit 0,6"; $run_posts = mysqli_query($con,$select_posts); $post=array(); while($row=mysqli_fetch_array($run_posts)){     $post[$row['post_id']]['id'] = $row['post_id'];     $post[$row['post_id']]['title'] = $row['post_title'];     $post[$row['post_id']]['date'] = $row['post_date'];     $post[$row['post_id']]['author'] = $row['post_author'];     $post[$row['post_id']]['image'] = $row['post_image'];     $post[$row['post_id']]['keywords'] = $row['post_keywords'];     $post[$row['post_id']]['content'] = $row['post_content'];     $post[$row['post_id']]['summary'] = $row['post_summary']; } 

then loop results display:

foreach($post $p){  echo "  <h1>$p['title']</h1>  <p>$p['summary']</p></br>  <a style='float:right;font-size:30px;margin-top:-30px;' href='blog_post_content.php?post_id=$p['id']'>readmore</a>"; } 

Comments