Forum Moderators: coopster
<?php
$con = mysql_connect("localhost","","");
if (!$con)
{
echo "8";
}
mysql_select_db("897897", $con);
error_reporting(E_ALL);
$check_if_got_award = mysql_query("SELECT ID_MEMBER , ID_AWARD FROM smf_awards_members WHERE ID_MEMBER=$zx35 AND ID_AWARD=$awardid") or die(mysql_error());
while ($row = mysql_fetch_assoc($check_if_got_award))
{
if(mysql_num_rows($check_if_got_award)==0)
{
$give_award = mysql_query("SELECT ID_MEMBER FROM smf_awards_members WHERE ID_MEMBER=$zx35") or die(mysql_error());
while ($row = mysql_fetch_assoc($give_award))
{
if ($row['ID_MEMBER']==$zx35)
{
mysql_query("INSERT INTO smf_award_members (ID_AWARD , ID_MEMBER)
VALUES ($awardid, $zx35") or die(mysql_error());
echo '1';
}
}
}
}
if(mysql_num_rows($check_if_got_award)!==0)
{
echo '5';
}
mysql_close($con);
?>
[edited by: Ben878 at 10:24 pm (utc) on Feb. 7, 2008]
[edited by: eelixduppy at 10:44 pm (utc) on Feb. 7, 2008]
ini_set("display_errors", "on");
ini_set("error_reporting", E_ALL);
If you still have a completely blank page, then there is a parse error somewhere. In other words, a missing semicolon, mismatched () or {}, or perhaps an invisible character.
A good approach to that situation is to add something at the top of your code like
echo 'Hi!';and remove entire blocks of code until you can get that message to appear. Then add back in your code in smaller chunks until the message disappears. Whichever block of code you added back in last is causing the problem, look carefully at that block to find the cause.
These two threads are good reads as well:
Troubleshooting 101 revisited [webmasterworld.com]
Troubleshooting [webmasterworld.com]
Now this appears to be the only problem:
if(mysql_num_rows($check_if_got_award)==0)
{
$give_award = mysql_query("SELECT ID_MEMBER FROM smf_awards_members WHERE ID_MEMBER=$zx35");
while ($row = mysql_fetch_assoc($give_award))
{
if ($row['ID_MEMBER']==$zx35)
{
mysql_query("INSERT INTO smf_award_members VALUES (ID_AWARD , ID_MEMBER);
VALUES ($awardid, $zx35");
echo '1';
}
}
}
If the query $check_if_got_award returns 0 I get a blank page. However if a query returns something other than 0 it works as it is meant to. :) So basically it is jsut this section of code that is messing up.
Also, if you get blank pages and you have access to your log files, the answer will be in your error log. (error.log if you are using apache) An error may be occurring before your ini setting calls.
mysql_query("INSERT INTO smf_award_members VALUES (ID_AWARD , ID_MEMBER);
VALUES ($awardid, $zx35");
Try replacing those two lines with this one line:
mysql_query("INSERT INTO smf_award_members (`ID_AWARD`, `ID_MEMBER`) VALUES ($awardid, $zx35);");