The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> blank page
minidiapolis
post Oct 7 2011, 01:16 PM
Post #1


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



Why am I getting a blank page with this code?

<?php
require_once("functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
DatabaseConnection();

$query= "SELECT * FROM treats";
$result_set= mysql_query($query) or die(mysql_error());

$output = "<table>";
while($row = mysql_fetch_array($result_set))
$product_id = $row['product_id'];
$product_title = $row['product_title'];
$product_Description = $row['product_Description'];
$product_price = $row['product_price'];
{
/*$productDetail1['product_id'];
$productDetail2['product_title'];
$productDetail3['product_Description'];
$productDetail4['price'];
$productDetail5['product_pic']; */
$output .= ("
<tr>
<td>".$row['product_id']."</td>
<td>".$row['product_title']."</td>
<td>".$row['product_Description']."</td>
<td>".$row['product_price']."</td>
</tr>
")
;
$output .= "</table>";
echo $output;
/*while($row = mysql_fetch_array($result))
{
echo "<table>";
echo "</td><td>";
echo $row['product_id'];
echo "</td><td>";
echo $row['product_title'];
echo "</td><td>";
echo "</rd></tr>";
}
echo "</table>";
*/
?>
</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Oct 7 2011, 02:51 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



Put the following line of code at the beginning of you PHP file, just after <?php
CODE
ini_set('display_errors','ON');


Surely the page will display errors.

Thse page also might help:
http://php.net/manual/en/function.mysql-fetch-array.php
http://php.net/manual/en/control-structures.while.php
http://www.w3schools.com/PHP/php_mysql_select.asp
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 7 2011, 04:13 PM
Post #3


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



now I'm getting an unexpected $end error.

<?php
/*ini_set ("display_errors", "1");
error_reporting(E_ALL);*/
DatabaseConnection();

$query= "SELECT * FROM treats";
$result_set= mysql_query($query) or die(mysql_error());

$output = "<table>";
while($row = mysql_fetch_array($result_set))
$product_id = $row['product_id'];
$product_title = $row['product_title'];
$product_Description = $row['product_Description'];
$product_price = $row['product_price'];
{
/*$productDetail1['product_id'];
$productDetail2['product_title'];
$productDetail3['product_Description'];
$productDetail4['price'];
$productDetail5['product_pic']; */
$output .= ("
<tr>
<td>".$row['product_id']."</td>
<td>".$row['product_title']."</td>
<td>".$row['product_Description']."</td>
<td>".$row['product_price']."</td>
</tr>
");

$output .= "</table>";
echo $output;
/*while($row = mysql_fetch_array($result))
{
echo "<table>";
echo "</td><td>";
echo $row['product_id'];
echo "</td><td>";
echo $row['product_title'];
echo "</td><td>";
echo "</rd></tr>";
}
echo "</table>";
*/
?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 7 2011, 04:16 PM
Post #4


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



found it
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 7 2011, 04:20 PM
Post #5


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



it 's still not displaying anything

<?php
require_once("functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
DatabaseConnection();

$query= "SELECT * FROM treats";
$result_set= mysql_query($query) or die(mysql_error());

$output = "<table>";
while($row = mysql_fetch_array($result_set))
$product_id = $row['product_id'];
$product_title = $row['product_title'];
$product_Description = $row['product_Description'];
$product_price = $row['product_price'];
{
/*$productDetail1['product_id'];
$productDetail2['product_title'];
$productDetail3['product_Description'];
$productDetail4['price'];
$productDetail5['product_pic']; */
$output .= ("
<tr>
<td>".$row['product_id']."</td>
<td>".$row['product_title']."</td>
<td>".$row['product_Description']."</td>
<td>".$row['product_price']."</td>
</tr>
");
}
$output .= "</table>";
echo $output;
/*while($row = mysql_fetch_array($result))
{
echo "<table>";
echo "</td><td>";
echo $row['product_id'];
echo "</td><td>";
echo $row['product_title'];
echo "</td><td>";
echo "</rd></tr>";
}
echo "</table>";
*/
?>
</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 7 2011, 09:40 PM
Post #6


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



I figured out the problem.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 06:57 PM