Hello All,
Struck with a code here. Here is my code that fetches all the post from database. I have a deleteform with it. I want that this delete option should appear with those status only where loggedin user is the author of those status posts, For rest he shouldnot see delete sign. But my script is not doing so, it is showing delete with each post.
<?php
{
$myspeak="";$deleteform="";
$sql="SELECT * FROM sayitstatus WHERE type='a' ORDER by posttime DESC";
$query=mysqli_query($db_conx,$sql);
$statusnumrows = mysqli_num_rows($query);
if($statusnumrows>1){
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$id = $row["id"];
$author = $row["author"];$data = $row["data"];
if($author==$log_username)
{
$deleteform = '<form style="float:left;" method="post">';
$deleteform .='<input type="hidden" name="id" value='.$id.' >';
$deleteform .='<input name="del" type="submit" title="Delete this Speak" value="X">';
$deleteform .= '</form>';
}
$myspeak .='<div style="background-color:#fff;color:grey; font-size:16px; width:100%; margin-bottom:5px;overflow:hidden;"> <div><a style="color:grey" href="temp.php?u='.$author.'">'.$author.'</a></div><div style="margin-left:9%;">'.$data.'</div>'.$deleteform.'</div>';}
echo $myspeak;
}}?>
Thanks
Shail