...

View Full Version : Can't figure out why getting a blank screen...



zelig
11-23-2011, 02:46 PM
Good morning all!

I'm running this function, but for some reason, it's throwing up a blank white screen. I have no idea why.

The "echo $query" doesn't return anything, but those fields are all in the table I'm pulling from, so I don't understand what's going on.

Any help would be appreciated!

Thanks!



function attacks() {

$query = doquery("SELECT id, name FROM `attacks` ORDER BY name", "attacks");
echo $query;
$page = "<b><u>Edit attacks</u></b><br />Click on a attack name to edit it.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin_panel.php?do=editattack:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin_panel.php?do=editattack:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No attacks found.</td></tr>\n"; }
$page .= "</table>";
admindisplay($page, "Edit attacks");

}

myfayt
11-23-2011, 02:52 PM
Being in DK structure, this query


$query = doquery("SELECT id, name FROM `attacks` ORDER BY name", "attacks");

Needs to look like this


$query = doquery("SELECT id,name FROM {{attacks}} ORDER BY name", "attacks");

Also don't echo the query. Check for value instead.

zelig
11-23-2011, 03:00 PM
Ah, gotcha. Figured it out too...

Forgot to add it to the if (do) bit...

*headsdesk*



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum