Jump to content

[SOLVED] Any idea why this wouldn't be working?


2DaysAway

Recommended Posts

I want a message bar to appear if a player has been attacked or sent a message. When I load the script, the page is blank. I think it's my echo's but I've tried several ways and all same result.

 

Look at it and let me know if you see any code problems or know a better way to write it.

 

 <?$get = mysql_query("SELECT round FROM $tab[set] WHERE starts<$time and ends>$time ORDER BY starts ASC;");
while ($game = mysql_fetch_array($get)){
if(fetch("SELECT pimp FROM $tab[pimp] WHERE id='$id' AND rid='$game[round]';")){
$jo3 = "SELECT * from pimps where id='$id' AND rid='$game[round]'";
$jo4 = mysql_query($jo3);
$jo5 = mysql_fetch_array($jo4) or die ("Cannot Recieve Message");
if($jo5["messages"] >= 1) {
echo = "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
echo = "<div class='msg'><div align='center'>";
echo = "<a href='inbox.php?rid=$game[round]'>You Have Mail!</a>";
echo = "</div></div>";
echo = "</td></tr></table>";
}
if($jo5["attacks"] >= 1) {
echo = "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
echo = "<div class='attacked'><div align='center'>";
echo ="<a href='inbox.php?inbox=1&rid=$game[round]'>You've Been Attacked!</a>";
echo = "</div></div>";
echo = "</td></tr></table>";
  }
}?>

I'm not sure exactly what your doing here....

 

echo = "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";

 

but echo is a language construct, you don't assign values to it, you parse it an argument. eg;

 

echo "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";

ok, so I changed the echos and added a query warning. Still just getting a blank screen. So because of the blank screen, would my error lie in the echos? Or still somewhere in the query?

 

<?php
  $query = "SELECT round FROM `{$tab[set]}` WHERE `round`='$rid'";
$get = mysql_query($query);
if (!$get) {
$message  = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($game = mysql_fetch_array($get)){
if(fetch("SELECT pimp FROM `{$tab[pimp]}` WHERE `id`='$id' AND `rid`='$game[round]';")){
$jo3 = "SELECT * FROM pimps WHERE `id`='$id' AND `rid`='$game[round]'";
$jo4 = mysql_query($jo3);
$jo5 = mysql_fetch_array($jo4) or die ("Cannot Recieve Message");
if($jo5["messages"] >= 1) {
echo  "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
echo  "<div class=\"msg\"><div align=\"center\">";
echo  "<a href='inbox.php?rid=$game[round]'>You Have Mail!</a>";
echo  "</div></div>";
echo  "</td></tr></table>";
}
if($jo5["attacks"] >= 1) {
echo  "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
echo  "<div class=\"attacked\"><div align=\"center\">";
echo "<a href='inbox.php?inbox=1&rid=$game[round]'>You've Been Attacked!</a>";
echo  "</div></div>";
echo  "</td></tr></table>";
}
  }?>

If you have an error in your SQL syntax then why isn't your error catching block giving a warning? I'm pretty sure mysql_query returns false on failure. Perhaps revraz is right and you've got a parse error or something somewhere which isn't being displayed.

 

If you have access to your php.ini file then try setting error_reporting to E_ALL.

 

// } <<< added

<?php
  $query = "SELECT round FROM `{$tab[set]}` WHERE `round`='$rid'";
$get = mysql_query($query);
if (!$get) {
$message  = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($game = mysql_fetch_array($get)){
if(fetch("SELECT pimp FROM `{$tab[pimp]}` WHERE `id`='$id' AND `rid`='$game[round]';")){
$jo3 = "SELECT * FROM pimps WHERE `id`='$id' AND `rid`='$game[round]'";
$jo4 = mysql_query($jo3);
$jo5 = mysql_fetch_array($jo4) or die ("Cannot Recieve Message");
if($jo5["messages"] >= 1) {
echo  "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
echo  "<div class=\"msg\"><div align=\"center\">";
echo  "<a href='inbox.php?rid=$game[round]'>You Have Mail!</a>";
echo  "</div></div>";
echo  "</td></tr></table>";
}
if($jo5["attacks"] >= 1) {
echo  "<table border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
echo  "<div class=\"attacked\"><div align=\"center\">";
echo "<a href='inbox.php?inbox=1&rid=$game[round]'>You've Been Attacked!</a>";
echo  "</div></div>";
echo  "</td></tr></table>";
}
  }
}
  ?>

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.