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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.