page not displaying anything

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Trevor_needs_help
Forum Newbie
Posts: 20
Joined: Thu Jan 29, 2004 8:13 am

page not displaying anything

Post 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();
}

?>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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
Trevor_needs_help
Forum Newbie
Posts: 20
Joined: Thu Jan 29, 2004 8:13 am

Post by Trevor_needs_help »

thanks
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Should be

Code: Select all

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