Jump to content


Photo

Problem With My Script


  • Please log in to reply
2 replies to this topic

#1 dark dude

dark dude
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 28 June 2006 - 06:55 PM

What's the problem with my script? I get a white page opening it, indicating a problem with the script, but I cant find the problems...

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?
session_start();

$Username = $_SESSION['Username'];

include("dbinfo.inc.php");

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "SELECT * FROM Users WHERE Username='$Username'";
$result = mysql_query($query) or die(mysql_error());

$results = mysql_fetch_array($result);

$query = "SELECT * FROM Alliances WHERE AllianceName='$results[Alliance]'";
$result2 = mysql_query($query) or die(mysql_error());

$results2 = mysql_fetch_array($result2);

$query = "SELECT * FROM Diplomacy WHERE AllianceName='$results[Alliance]'";
$result3 = mysql_query($query) or die(mysql_error());

$results3 = mysql_fetch_array($result3);

if($results[Alliance]==""){
?>
<table><tr><th>Alliance Search</th></tr><tr><td><form name="search" method="post" action="alliancesearch.php">Search Alliance Tag <input name="Search" type="text" size="20" maxlength="18"/> <input type="submit">Search</input></form></td></tr></table>
<?
} else {
?>

<table><tr><th>Alliance "<? echo $results2[AllianceName] ?>"'s Panel</th></tr>
<tr><td><center>Alliance Name: <? echo $results2[AllianceName] ?></td></tr>
<tr><td>Alliance Tag: <? echo $results2[AllianceTag] ?></td></tr>
<tr><td>Members: <? echo $results2[Members] ?></td></tr>
<tr><td>Rank: <? echo $results[AllianceRank] ?></td></tr>
<tr><td><? echo $results2[Description] ?></td></tr>
<tr><th>Diplomacy Status</th></tr>
<tr><td><?
if($results3[War]==""){
echo '<span style=color:red><b>Wars:</b></span> The Alliance is at Peace';
}
else {
echo '<span style=color:red><b>Wars:</b></span> 1.'.$results3[War].'<br>2.'.$results3[War2].'<br>3.'.$results3[War3].'<br>4.'.$results3[War4].'<br>5.'.$results3[War5].';
}
?>
</td></tr>
<tr><td><?
if($results3[Ally]==""){
echo '<span style=color:red><strong>Wars:</strong></span> The Alliance is Unified';
}
else {
echo '<span style=color:red><strong>Wars:</strong></span> 1.'.$results3[Ally].'<br>2.'.$results3[Ally2].'<br>3.'.$results3[Ally3].'<br>4.'.$results3[Ally4].'<br>5.'.$results3[Ally5].';
}
?>
</td></tr>
</table>
<?
}[/quote]


Thanks for any help ^_^,
~Dark dude~

#2 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 28 June 2006 - 07:03 PM

In the connect statement doesn't localhost need quotes around it? At any rate try turning on error reporting in the php.ini file and let us know what line the error is reported (preferably by marking it in the code), if you can't get error reporting on then try echoing from the top of your script down, till you hit the part that doesn't work.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#3 dark dude

dark dude
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 28 June 2006 - 07:16 PM

Oh, it's because I didnt escape properly, it's fixed now, but thanks for telling me about the echo bug check thing, that saved my neck =]


Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users