Jump to content

While statement not producing results


marcus

Recommended Posts

Make admin addon for a game I am making, hehe. Deleting news, the while statement is not spitting out the results.

[code=php:0]
//START...DELETE NEWS************
if($act == deletenews){
$nid = $_GET[nid];

if(!isset($nid)){
$sqlBB = "SELECT * FROM news ORDER BY id DESC";
$resAA = mysql_query($sqlBB) or die(mysql_error());
echo "<table border=0 cellspacing=3 cellpadding=2>\n";
echo "<tr><td class=boardB align=left>News Title<td class=boardB>Author<td class=boardB>Delete Link\n";
while($rowBB == mysql_fetch_array($resAA)){
echo "<tr><td class=boardB align=left>$rowBB[title]<td class=boardB>$rowBB[poster]<td class=boardB><a href='admin.php?act=deletenews&nid=$rowBB[id]'>Delete News ID #$rowBB[id]</a>\n";
}
echo "</table>";
}else {

$sql = "SELECT * FROM `news` WHERE `id` =$id";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) == 0){
error("This news article does not exist!");
}else {

$sql = "DELETE FROM `news` WHERE `id` =$id";
$res = mysql_query($sql) or die(mysql_error());
echo "This news article has been deleted!<br><a href='admin.php?act=deletenews'>Go Back</a>";
}
}
}
//END....DELETE NEWS*************
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33541-while-statement-not-producing-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.