Needing a point in the right direction

Hi all,

I’m trying to amend some code and trying what i know to make it work. but i’m just getting a white page atm. I’ve checked over the couple files i’ve got with my limited understanding of php and finding the new part wont output right.

The code below, if I remove everything from the else up it works fine. But I’d like to have the report link output the information into a defined table(which isn’t coded here fully).

[php]<?php
include_once ‘connect2.php’;

if(isset($action) && $action == ‘showRecord’)
{

// Show full report
$matchid = $_GET[‘matchid’];
$title = “Show match report”;
include_once ‘headerm.php’;
$resulta = mysql_query(“SELECT matchid,home,away,day,month,year,time,ampm,winloss,scorehome,scoreaway,matchtype,gamemode,gamepreset,gamepack,map1,map2,map3,map4,rule1,rule2,rule3,rule4,rule5,report,complete FROM ukematch WHERE matchid=$matchid”);
list($matchid,$home,$away,$day,$month,$year,$time,$ampm,$winloss,$scorehome,$scoreaway,$matchtype,$gamemode,$gamepreset,$gamepack,$map1,$map2,$map3,$map4,$rule1,$rule2,$rule3,$rule4,$rule5,$report,$complete) = mysql_fetch_array($resulta);
?>

UKE Match Admin Page

Welcome to the admin page for the UKE Matches. From here you can update the details of the matches we have finished and awaiting to happen.
Please if you change this, post into the admin chat on forums to let me know.
Thanks

UKE Admin Team

<?php echo "\n"; echo "\n"; echo "\n"; while ($row = mysql_fetch_array($resulta)) { list($matchid,$home,$away,$day,$month,$year,$time,$ampm,$winloss,$scorehome,$scoreaway,$complete) = $row; // Images for status... // Put images in the same directory as this file... $onlineImage = "greenfinal.gif"; // Replace image.png with the name of the image $offlineImage = "redfinal.gif"; // Replace image.png with the name of the image $workImage = "yellow.jpg"; // Replace image.png with the name of the image $winlossImage = ""; if ($winloss == 'Win') { $winlossImage = $onlineImage; $winlossColor="#00dd00"; } if ($winloss == 'Loss') { $winlossImage = $offlineImage; $winlossColor="#dd0000"; } if ($winloss == 'Draw') { $winlossImage = $workImage; $winlossColor="#dddd00"; } if ($home == 'UKE') {$homeColor="00dd00";} if ($home != 'UKE') {$homeColor="dd0000";} if ($away == 'UKE') {$awayColor="00dd00";} if ($away != 'UKE') {$awayColor="dd0000";} echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " "; echo " \n"; } echo "\n"; echo "
Home Away W/L Home Score Away Score Match Complete

$home$away$winloss$scorehome$scoreaway$completeReport

\n"; } else { $title = 'Match Menu'; include_once 'header.php'; $sql = mysql_query("SELECT matchid,home,away,day,month,year,time,ampm,winloss,scorehome,scoreaway,complete FROM ukematch WHERE complete='Yes' ORDER BY matchid DESC LIMIT 5"); ?>

UKE Match Admin Page

Welcome to the admin page for the UKE Matches. From here you can update the details of the matches we have finished and awaiting to happen.
Please if you change this, post into the admin chat on forums to let me know.
Thanks

UKE Admin Team

<?php

echo “

<table width=“75%” cellpadding=“6” align=“center”>\n”;
echo “

HomeAwayW/LHome ScoreAway ScoreMatch Complete\n”;
echo “<tr height=“2”><td colspan=“6”>
\n”;
while ($row = mysql_fetch_array($sql))
{
list($matchid,$home,$away,$day,$month,$year,$time,$ampm,$winloss,$scorehome,$scoreaway,$complete) = $row;
// Images for status...
// Put images in the same directory as this file...

$onlineImage = "greenfinal.gif"; // Replace image.png with the name of the image
$offlineImage = "redfinal.gif";  // Replace image.png with the name of the image
$workImage = "yellow.jpg";  // Replace image.png with the name of the image

$winlossImage = "";
if ($winloss == 'Win') { $winlossImage = $onlineImage; $winlossColor="#00dd00"; }
if ($winloss == 'Loss') { $winlossImage = $offlineImage; $winlossColor="#dd0000"; }
if ($winloss == 'Draw') { $winlossImage = $workImage; $winlossColor="#dddd00"; }

if ($home == 'UKE') {$homeColor="00dd00";}
if ($home != 'UKE') {$homeColor="dd0000";}
if ($away == 'UKE') {$awayColor="00dd00";}
if ($away != 'UKE') {$awayColor="dd0000";}
    
echo " <tr>\n";
echo " <tr>\n";
echo "  <td><font color=\"$homeColor\">$home</font></td>\n";
echo "  <td><font color=\"$awayColor\">$away</font></td>\n";
echo "  <td><font color=\"$winlossColor\">$winloss</font></td>\n";
echo "  <td>$scorehome</td>\n";
echo "  <td>$scoreaway</td>\n";
echo "  <td>$complete</td>\n";
echo "  <td align=\"center\"><a href=\"admin.php?action=showRecord&matchid=$matchid\">Report</a></td>";
echo " </tr>\n";

}
echo “<tr height=“2”><td colspan=“6”>


\n”;
echo “\n”;

include_once ‘upcomming.php’;
include_once ‘footer.php’;
?>[/php]

Have you tried forcing errors to display? At the top of the file add error_reporting(E_ALL);

[php]<?php
error_reporting(E_ALL);
include_once ‘connect2.php’;[/php]

yes, put in the code before posting here. it didn’t output any errors just stayed ont eh white page. The top part of the code I’ve stripped out and put into a php file alone and change the sql query for it and it outpus fine. I just can’t get it to work when I click on the “report” button to show code at the top of the file.

Just to check, has connect2.php got the code:

[php]$action = $_GET[‘action’];[/php]

Or could that be your issue

connect2.php is just db connection code. Added in the $action = $_GET[‘action’]; under db include_once, also readded error checker. Still showing white page with nothing on it.

I’ve a single file that has the code i’ve been changing to get this page to work. the $_GEt action is in the same place as this. If you want I can show you the code i’ve been working from. Has add/modify/delet and a table with output from DB in single file.

A very basic and simple (yet effective) method I sometimes use for situations such as this, is to create an echo command (echoing anything, as long as I can see it). Place it at the top of the file and refresh. If you can read the echoed data, move that line under the next bit of code and refresh again. Keep refreshing and moving until you find the code that stopped your echo from working - that code is the issue.

If you’re confident it’s in this file, you could try it. If you say the other stuff shows fine, just start from within the if statement that isn’t showing anything.

Smokey nice idea, and I put echo “print”; under the top <?php and still white page. so it has to be something on the added code upto the else statement. Need to rethink this a bit more.

after a little thinking regarding my issue. I split the file into 2 .php files and linked them in the hope this would at least let me tweak the code as needed. Both pages worked after making sure all {} ; etc where in place.

So taking this, I put them into one page. and both pages now show. Just have dbase access and layout to sort and it should be done. Need to check over the code to see the missing things. I’ll post up the difference for reference.

From what i can see on both pages. the missing bits of code are.

Top of file above opening IF statement
$action = $_GET[‘action’];

End of file above ?>
} <- think this was my main issue for the white page. rest is unchanged from what i can see

For this else block, there is no closing } in your code. Or do you have this in the included files?
[php]else
{
$title = ‘Match Menu’;
include_once ‘header.php’;
$sql = mysql_query(“SELECT matchid,home,away,day,month,year,time,ampm,winloss,scorehome,scoreaway,complete FROM ukematch WHERE complete=‘Yes’ ORDER BY matchid DESC LIMIT 5”);
?>[/php]

oops, I didn’t refresh the page before posting :slight_smile: You seem was able to fix your code yourself.

After going over the file and re-working it so both parts of it work. I double checked the code and made sure all {} where closed and file is now working as I wanted it. I can now start designing the layout for it in a table.

thank you for the help tho, some nice Idea’s for error checking I’ll keep using

Sponsor our Newsletter | Privacy Policy | Terms of Service