Here's the whole code of my php page. Thanks! I took away some unnecessary bits and removed database passwords.
Code:
<?php
$id = $_GET['id'];
// Connect to db
try
{
$pdo = new PDO('mysql:host=localhost;dbname=dbname', 'user', 'pw');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('SET NAMES "utf8"');
}
catch (PDOException $e)
{
echo "Unable to connect to the database server!<br>" . $e;
exit();
}
?>
<!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>fh|<?php echo $row['name']; ?></title>
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" type="text/css" href="css/resets.css" />
<link rel="stylesheet" type="text/css" href="css/jbslider.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.jscrollpane.css" />
<link rel="stylesheet" type="text/css" href="custom_css.css" />
<script type="text/javascript" src="js/jquery-1.7.min.js"> </script>
<script type="text/javascript" src="js/jquery-ui-1.8.12.min.js"> </script>
<script type="text/javascript" src="js/jquery.jscrollpane.min.js"> </script>
<script type="text/javascript" src="js/jbslider.min.js"> </script>
<script type='text/javascript' src='/js/lib/mootools-core-1.3-full-compat-nc.js'></script>
<script type="text/javascript">
function Toggle(id,close,open,ms){
var obj=document.getElementById(id),o=Toggle['zxc'+id],to;
if (!o&&obj){
Toggle['zxc'+id]=o={
obj:obj,
now:0,
ms:500,
ud:true
}
}
if (o){
ms=typeof(ms)=='number'?ms:o.ms;
obj.style.display='block';
to=o.ud?open:close;
clearTimeout(o.dly);
animate(o,o.now,to,new Date(),ms*Math.abs((to-o.now)/open));
o.ud=!o.ud;
}
}
function animate(o,f,t,srt,mS){
var oop=this,ms=new Date().getTime()-srt,now=(t-f)/mS*ms+f;
if (isFinite(now)){
o.now=Math.max(now,0);
o.obj.style.height=o.now+'px';
}
if (ms<mS){
o.dly=setTimeout(function(){ oop.animate(o,f,t,srt,mS); },10);
}
else {
o.now=t;
o.obj.style.height=o.now+'px';
if (t==0){
o.obj.style.display='none';
}
}
}
</script>
<script type="text/javascript">
animatedcollapse.addDiv('jason', 'optional_attribute_string')
//additional addDiv() call...
//additional addDiv() call...
animatedcollapse.init()
</script>
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="contain">
<div id="header">
<div id="hwrapper">
<a href="/index.php" id="logo"><img src="flogo.png" alt="Logo" width="460px" height="140px"/></a>
</div>
</div>
<div id="container">
<div id="line">
</div>
<div id="navbar">
<div id="nav">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="list.php">Restaurant List</a></li>
<li><a href="submit.php">Submit a Restaurant</a></li>
<li><a href="about.php">About</a></li>
<li><a href="#"><div class="button open-button" onMouseUp="Toggle('page-split-wrap',0,250,500);"><span style="font-style:italic; font-size:19px;">Restaurant Search</span></div></a>
</li>
</ul>
</div>
<div id="body">
<div id="page-split-wrap">
<div class="page-split-head"> </div>
<div class="page-split-content">
<p class="inside">
<form method="get" action="/search1/search.php">
<div>
<input type= "text" name= "q" value="Search" class="inputtext" onFocus="this.value=''"/>
<input type="hidden" name= "cat" value="" class="inputtext"/>
<input type="hidden" name= "time" value="0" class="inputtext"/>
<input type="hidden" name="letter" value="" class="inputtext"/>
<input type="hidden" name="offset" value="0" class="inputtext"/>
<input type="hidden" name= "type" value="quick" class="inputtext"/>
<br />
<br />
<div id="submitsearch">
<input type="submit" style="font-size:16px;" value="Search" class="sbutton"/>
</div>
</div>
</form>
</p>
</div>
</div>
<div id="wrapperb">
<?php
// The query
$id = (int) $_GET['id'];
$sql= $pdo->prepare('SELECT * FROM review WHERE id = :id');
$sql->execute(array(':id' => $id));
if ($sql->rowCount() === 0)
{
echo '<br>Sorry, but the id did not match anything in the database.
}
else
{
foreach ($sql as $row) {
echo '<div id="infobar"><span class="restaurantname"><div id="namealign">'.$row['name'].'</div></span><div id="inforight">'.$row['cuisine'].'<br><span class="address">'.$row['address'].'<br>'.$row['phone'].'</div></div><br>'
</div>
<div id="footer">
<div id="wrapperb">
<div id="footerlinks">
<img src="about.png" width="220" height="207" />
<img src="contact.png" width="220" height="207" />
<img src="terms.png" width="220" height="207" />
<img src="holder.png" width="220" height="207" />
</div>
<?php include 'footer.php'; ?>
<img src="http://hitwebcounter.com/counter/counter.php?page=4612375&style=0007&nbdigits=5&type=page&initCount=0" title="" Alt="" border="0" >
</body>
</html>
Bookmarks