hi all,
first i want to say I am new to php.
I'm developing a blog where administrator can get all comments replied by the users.
I can view it in a html table.
But now what I need is dynamically delete , edit them.
i tried this
include '../Classes/DBhandling.php';
include '../Classes/config.php';
$dob = new Dbhandling($dbHost,$dbUser,$dbName,$dbPass);
$dob->connectDB();
$qry="select * from usercomments";
$result=mysql_query($qry);
echo '<table border=1 align="center">'.'<thead>'.'<tr>'.'<th>'."PO_ID".'</th>';
echo '<th>'."C_ID".'</th>'.'<th>'."USER_NAME".'</th>'.'<td width=300; align="center">'."COMMENT".'</th>';
echo '<th>'."DATE".'</th>';
echo '<th>'."ALLOW".'</th>';
echo '<th>'.'DEL'.'</th>'.'</tr>';
echo '</thead>';
while($row=mysql_fetch_array($result)){
echo '<tbody>';
echo '<tr>'.'<td align="center" >'.$row['postId'].'</td>';
echo '<td align="center" >'.$row['commentId'].'</td>';
echo '<td align="center" >'.$row['name_cm'].'</td>';
echo '<td align="center" >'.$row['comment_cm'].'</td>';
echo '<td align="center" >'.$row['dateComment_cm'].'</td>';
echo '<td align="center" >'.$row['allow_cm'].'</td>';
$cmId=$row['commentId'];
echo '<form action="delete.php?cmId='.$cmId.'">';
echo '<td align="center" >'.'<input type="submit" value="Del" name="" />'.'</td>'.'<tr>';
// echo "ID".$row['id']."<$> ".$row['title']." ".$row['popst'];
echo ' </form>';
//echo '<form action="delete.php?cmId='.$cmId.'">';
//echo "printr".print_r($row);
}
echo '</tbody>'.'</table>';
$dob->closeDB();
// put your code here
?>
but i coudn't get the comment id to delete.
if any how I can get the comment ID then I can manage to delete the comment.
therefore, I think the proplem arise in
echo '<form action="delete.php?cmId='.$cmId.'">';
echo '<td align="center" >'.'<input type="submit" value="Del" name="" />'.'</td>'.'<tr>';
// echo "ID".$row['id']."<$> ".$row['title']." ".$row['popst'];
echo ' </form>';
Can anybody help me to do this . Please
give me a little hint or example code.
I use php, mysql
I think u can understand me.
thx in advance,
menuka.