php logical problem

I am new at this but i am trying to make a form for a school project i have. The problem is when i have the admin try to edit a post i always get the last one that is displays. I think i need a array but i am not sure how to test it to see which one they pick. I want to make it where they select only one and edit that post. The $_SESSION[‘blogid’] is what i tried first to determine what blog i pick but every time it loop it just is overwritten. The following code works fine i just need ideas how to do it with the code i have done here so far. Thanks in advance for you help.

[php] <?php
$fetch=mysql_query("SELECT * FROM blog WHERE flag=‘0’ ");
$i=1;
$row=mysql_num_rows($fetch);
if($row>0){
while($data=mysql_fetch_array($fetch,1)){

?>

<?php echo $i; ?>
<a href="index.php?action=<?php echo $data['id']; ?>" >
 <strong><?php echo $data['name']; ?></strong>
  </a>
  
   <br />
  <?php echo nl2br(substr($data['description'],0,100))."...";
         
		$_SESSION['blogid']= $data['id'];  
		

   
  ?>
  
  <br />
<a href="?edit">edit</a>
<?php $i++;} }else{?> No record found <?php } ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service