Location: PHPKode > projects > RecipeNet > index.php
<?php include 'common.php';
@mysql_connect($dbhost,$dbuser,$dbpass); 
@mysql_select_db($db);
$query0="SELECT * FROM rn_settings
WHERE settid='e7H78fah9fhj'";
$result0=mysql_query($query0);
$num0=mysql_numrows($result0) or die('It appears that you have not <a href="install.php>installed</a> RecipeNet yet.');
$i=0;
while ($i < $num0) {
$sitename=mysql_result($result0,$i,"sn"); ?>
<!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><?php echo $sitename; ?> - Homepage</title>
</head>
<body>
<p align="center">
  <?php
echo '<p align="center"><strong>'; print("$sitename"); echo '</strong></p>
<p align="center"><a href="index.php"><img src="logo.jpg" width="300" height="100" alt="'; print("$sitename"); echo '"/></a></p>';
$i++;
}
if ($_GET['show'] < '0') { ?>
</p>
<table width="100%" border="1">
  <tr>
    <td width="23%"><b>Recipe Name</b></td>
    <td width="13%"><b>Original Creator</b></td>
    <td width="9%"><b>Level</b></td>
    <td width="19%"><b>Number of Main Ingredients</b></td>
    <td width="19%"><b>Food Type</b></td>
    <td width="17%"><b>Approx. Time to make</b></td>
  </tr>
  <tr>
<?php
$querymain="SELECT * FROM rn_recipes ORDER BY id desc";
$resultmain=mysql_query($querymain);
$nummain=mysql_numrows($resultmain);
$i=0;
while ($i < $nummain) {
$rid=mysql_result($resultmain,$i,"id");;
$rcreator =mysql_result($resultmain,$i,"creator");
$rname=mysql_result($resultmain,$i,"name");
$rlevel=mysql_result($resultmain,$i,"level");
$rnumain=mysql_result($resultmain,$i,"numain");
$rgenre=mysql_result($resultmain,$i,"genre");
$rtime=mysql_result($resultmain,$i,"time");
?>
    <td><a href="index.php?show=<?php echo $rid; ?>"><?php echo $rname; ?></a></td>
    <td><?php echo $rcreator; ?></td>
    <td><?php echo $rlevel; ?></td>
    <td><?php echo $rnumain; ?></td>
    <td><?php echo $rgenre; ?></td>
    <td><?php echo $rtime; ?></td>
  </tr>
  <?php
  $i++;
}
echo '</table>';
}
if ($_GET['show'] > '0') {
$did=$_GET['show'];
$queryshow="SELECT * FROM rn_recipes WHERE id='$did'";
$resultshow=mysql_query($queryshow);
$numshow=mysql_numrows($resultshow);
$i=0;
while ($i < $numshow) {
$dname=mysql_result($resultshow,$i,"name");
$dsubmit=mysql_result($resultshow,$i,"submit");
$dcreator=mysql_result($resultshow,$i,"creator");
$dnuming=mysql_result($resultshow,$i,"numing");
$dnumain=mysql_result($resultshow,$i,"numain");
$dgenre=mysql_result($resultshow,$i,"genre");
$dlevel=mysql_result($resultshow,$i,"level");
$dtime=mysql_result($resultshow,$i,"time");
$ding=mysql_result($resultshow,$i,"ing");
$dtext=mysql_result($resultshow,$i,"text"); ?>
<p align="center"><strong>Recipe Name:</strong> <?php echo $dname; ?></p>
<table width="100%" border="1">
  <tr>
    <td width="17%">Submited By:</td>
    <td width="83%"><?php echo $dsubmit; ?></td>
  </tr>
  <tr>
    <td>Originally created by:</td>
    <td><?php echo $dcreator; ?></td>
  </tr>
  <tr>
    <td>Number of Ingredients:</td>
    <td><?php echo $dnuming; ?></td>
  </tr>
  <tr>
    <td>Number of main ingredients:</td>
    <td><?php echo $dnumain; ?></td>
  </tr>
  <tr>
    <td>Food Type:</td>
    <td><?php echo $dgenre; ?></td>
  </tr>
  <tr>
    <td>Level:</td>
    <td><?php echo $dlevel; ?></td>
  </tr>
  <tr>
    <td>Time To Make (minutes):</td>
    <td><?php echo $dtime; ?></td>
  </tr>
  <tr>
    <td>Ingredients:</td>
    <td><?php echo $ding; ?></td>
  </tr>
  <tr>
    <td>Recipe:</td>
    <td><?php echo $dtext; ?></td>
  </tr>
</table>
<?php
$i++;
}
}
?>
<p align="right"><a href="add.php">(Add A Recipe)</a></p>
</body>
</html>
<?php mysql_close(); ?>
Return current item: RecipeNet