Page 1 of 1

page not displaying anything

Posted: Sun Feb 01, 2004 7:38 am
by Trevor_needs_help
this is a link from anoter page it was not working with a http error which i fixed i changed my web server to apache and set it up manually for windows (FUN!). but now nothing is displayed when the page is loaded can any one help.. the code is below

<?php
// Include the error management
require_once ('4dm1n/config.inc');
require_once ('../mysql_connect.php'); // Connect to the database.
if (is_numeric ($_GET['pid'])) {


$query ="SELECT * FROM meal ={$_GET['pid']}";
$result = mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_ASSOC);
mysql_close(); // Close the database connection.

// Set the page title and include the HTML header.
$page_title = $row['meal_name'];
include_once ('includes/header.html');

// Display a header.
echo "<div align=\"center\">
<b>{$row['meal_name']}</b> by
<br />{$row['size']}
<br />\${$row['price']}
<a href=\"add_cart.php?pid={$row['meal_id']}\">Add to Cart</a>
</div><br />";

//Get the image information and display the image.
if ($image = @getimagesize ("../uploads/{$row['image_name']}")) {
echo "<div align=\"center\"><img src=\"../uploads/{$row['image_name']}\" $image[3] alt=\"{$row['print_name']}\" />";
} else {
echo "<div align=\"center\">No image available.";
}
echo '<br />' . stripslashes($row['descripiton']) . '</div>';

include_once ('includes/footer.html'); // Require the HTML footer.

}
else { // Redirect

header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");


exit();
}

?>

Posted: Sun Feb 01, 2004 7:41 am
by markl999
$query ="SELECT * FROM meal ={$_GET['pid']}"; is not a valid query.

Using error_reporting(E_ALL); and mysql_error() catches things like that :p

Posted: Sun Feb 01, 2004 7:57 am
by Trevor_needs_help
thanks

Posted: Sun Feb 01, 2004 8:16 am
by d3ad1ysp0rk
Should be

Code: Select all

$query = "SELECT * FROM meal WHERE var = {$_GET['pid']}";