You are here: Re: PHP Blank Page. « PHP Programming Language « IT news, forums, messages
Re: PHP Blank Page.

Posted by techjohnny@gmail.com on 06/19/07 18:11

On Jun 19, 10:59 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Tue, 19 Jun 2007 19:18:02 +0200, techjoh...@gmail.com
>
> <techjoh...@gmail.com> wrote:
> > Ok,
>
> > I posted earlier about this, a blank php page. I've enabled logging
> > ALL in the php.ini, but nothing. If I change the name of the db in
> > the include file, I get an error message, so I guess this means it's
> > connecting to the mysql db. I've included the first couple lines of
> > code for this page:
>
> First rule of hunting errors: do not surpress any errors by @ if something
> isn't working.
>
> Second: I do not see any output, so as far as I'm concerned if you've got
> no errors you would still see nothing.
>
> - $qry['cat'] doesn't seem to be set anywhere, how come?
> - check your queries for errors: echo mysql_error(), and the query itself.
>
> --
> Rik Wasmus

The entire page:

<?php
include('inc/header.inc.php');
require_once('inc/db_config.inc.php');
session_start();
$conn = db_connect();

$sqlsu = "SELECT * FROM subjects ORDER BY ID";
$ressu = mysql_query($sqlsu, $conn);
if (mysql_num_rows($ressu)) {
while ($qry = mysql_fetch_array($ressu)) {
$cat = stripSlashes($qry['cat']);
$resns = mysql_query("SELECT * FROM questions WHERE test LIKE '$cat'",
$conn);
$numcat = mysql_num_rows($resns);
if ($numcat > 0) {
// Check if scoreboard contains entries in this category and, if so,
list results
if (isset($HTTP_SESSION_VARS['scoreboard']) &&
($HTTP_SESSION_VARS['scoreboard'][$cat])) {
$totsub = 0;
$correctans = 0;
foreach ($HTTP_SESSION_VARS['scoreboard'][$cat] as $questi)
{
if ($questi == 'c') { $correctans++; }
$totsub++;
}
}
echo "\n".'<form name="teststart'.$qry['ID'].'" action="quiz.php"
method="post">';
echo '<li><p id="hornav">';
if ((!$totsub) || ($totsub < $numcat)) {
if ($totsub) { $togo = ($numcat - $totsub); } else { $togo =
$numcat; }
echo '<select name="limit">';
if ($togo > 5) { echo '<option value="5" SELECTED>5 questions</
option>'; }
for ($j = 1; $j < 12; $j++) {
if ($togo > ($j * 10)) { echo '<option value="'.($j*10).'">'.($j*10).'
questions</option>'; }
}
echo '<option value="'.$togo.'">';
if ($togo > 1) {echo ' all '; }
echo $togo;
if ($totsub > 0) { echo ' remaining'; }
echo '</option></select>';
}
if ($totsub >= $numcat) {
echo ' Test completed</p>'; }
else if ($totsub > 0) {
echo '<a href="javascript:document.teststart'.
$qry['ID'].'.submit()">Continue Test</a></p>'; }
else {
echo '<a href="javascript:document.teststart'.
$qry['ID'].'.submit()">Start Test</a></p>'; }

echo '<strong>'.$cat.'</strong> ';
echo '<em>('.$numcat.' questions)</em>';
echo '<br />';
echo '<input type="hidden" name="testsub" value="'.$cat.'">';
echo stripslashes($qry['descr']);

if ($totsub > 0) {
echo '<h3>Total score: '.$correctans.'/'.$totsub.'</h3>';
$totsub = 0;
$correctans = 0;
}

echo '</li>'."\n".'</form>'."\n";

echo '<hr />';
}
}
}
?>

</ol>
<br />
<?php include_once('inc/footer.inc.php'); ?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация