I need help with my script its supposed to pull down some values from a database its more of a prof of concept piece of work but im determined to finish it
basicly whats happining is that my values are not popping in the tables where there supposed to can anyone help me out heres the code
<?php
$header = <<< EOHEADER
<!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=iso-8859-1" />
<title>Search Products</title>
</head>
<body>
EOHEADER;
echo $header;
if ($_GET['Submit'] == "Submit") {
$search = $_GET['search'];
mysql_connect('localhost','root','password') or die ("Could Not Connect To Database");
mysql_select_db("digitald");
if (!$search || $search = "" || strlen($search) > 25) {
$message = "Please Search Something or Shorten Your Request";
}
else {
$query = "SELECT name , price , info FROM products WHERE name = '$search' ";
$results = mysql_query($query);
$product = mysql_fetch_assoc($results);
}
}
//Temparaiy Var Dump to see whats going On
var_dump($product);
//----------------------
$thisfile = $_SERVER['PHP_SELF'];
$content = <<< EOCONTENT
<div align="center">
<p>$message</p>
<form id="product_search" name="product_search" method="get" action="$thisfile">
<p>Search Products :
<input type="text" name="search" />
<input type="submit" name="Submit" value="Submit" />
</p>
<p><br />
</p>
<table width="550" border="1" cellpadding="0">
<tr>
<td>Name : $product[name] </td>
<td>Price : $product[price]</td>
<td>Info : $product[info] </td>
</tr>
</table>
</form>
</div>
<br />
</body>
</html>
EOCONTENT;
echo $content;
?>
when i make the $product[name] into $product['name'] i get a syntax error