One page works, but another page doesn't, it produces nothing *apart from initial HTML code.
Since I used the working one as a basis for the non-working one it should work, but it doesn't and I can't see my mistake.
The database strings produce the results I'm expecting in mysqladmin.
What surprises me is that I get no errors reported, does that mean that PHP hasn't understood my script ?
In the broken page, even the statement
echo "<!--\n$textquery\n-->";
produces nothing.
In the scripts below, I've left out the HTML and document references.
Working page
<head>
<?php
include 'dbconnect.php';
?>
</head>
<body>
<?php
$testquery = "SELECT * FROM catalogue WHERE instock = 'Y' ORDER BY title ASC";
$testresult = mysql_query($testquery);
if (!$testresult) {
echo ('Retrieval error <br />');
exit;
}
while ($row = mysql_fetch_array($testresult))
{
$title=$row['title'];
$instock=$row['instock'];
$description = $row['description'];
$bigpicture=$row['picture'];
echo "\n";
echo "<a href=\"javascript:picture('i/" .$bigpicture . "','" . $title . "') \" >\n" ;
echo $title ."</span><br /> \n";
echo $description ."<br /> \n";
\n";
}
?>
Broken page
<head>
<?php
include 'dbconnect.php';
?>
</head>
<body>
<?php
// retrieving the text
$textquery = "SELECT * FROM gallerytext WHERE pageno = 1";
echo "<!--\n$textquery\n-->";
$textresult = mysql_query($textquery);
if (!$textresult) {
echo ('Retrieval error <br />');
exit;
}
while ($row = mysql_fetch_array($textresult))
{
$pagetext=$row['pagetext'];
//Display text
echo $pagetext;
}
echo " \n";
echo "<strong>Themes</strong><br />";
// retrieving the theme names
$themequery = "SELECT DISTINCT ThemeName FROM gallery WHERE instock = 'Y' ORDER BY ThemeName";
$themeresult = mysql_query($themequery);
if (!$themeresult) {
echo ('Retrieval error <br />');
exit;
}
while ($row = mysql_fetch_array($themeresult))
{
$themename=$row['ThemeName'];
$themenameref=$row['$themenameref']
//Display text
echo $pagetext;
echo " \n";
echo "<a href='#".$themenameref."' title='".$themename."'>".$themename."</a><br />";
}
echo "<br /> <br /> </div> <table cellspacing='0' class='gallery'>";
// retrieving the pictures
$query = "SELECT * FROM gallery WHERE instock = 'Y' ORDER BY ThemeName, title";
$result = mysql_query($query);
if (!$result) {
echo ('Retrieval error <br />');
exit;
}
while ($row = mysql_fetch_array($result))
{
$title=$row['title'];
$themename=$row['ThemeName'];
$themenameref=$row['$themenameref']
$description = $row['description'];
$thumbnail=$row['thumbnail'];
$bigpicture=$row['picture'];
//Display table
echo " <tr><td>";
echo " <a name='".$themenameref."'></a>";
echo " <span class='white'>".$themename."</span><br />";
echo " </td>";
echo " <td>";
echo " <a href='javascript:picture('i/".$bigpicture."', '".$title."')' >";
echo " <img src='i/".$thumbnail."' alt='".$title."' width='300' title='".$title."' /></a>";
echo " <br />;
echo $title."<br />";
echo $description."nbsp;";
echo " </td></tr>";
}
?>
If you can see my obvious error, please point it out.
If you can't, please suggest how I might find it.