hi, i've been trying to figure out how to do the following, but no luck . Please help me out, or direct me to a turorial.
I'm a making a website with php(in Dreamweaver 8), and one of the pages is a list of recipes. they are in my database. (mysql). here is the code for them, which works just fine):
this is before any html:
<?php
$maxRows_Recipe_list = 10;
$pageNum_Recipe_list = 0;
if (isset($GET['pageNum_Recipe_list'])) {
$pageNum_Recipe_list = $GET['pageNum_Recipe_list'];
}
$startRow_Recipe_list = $pageNum_Recipe_list * $maxRows_Recipe_list;
mysql_select_db($database_Recipes, $Recipes);
$query_Recipe_list = "SELECT * FROM recipes ORDER BY recipes.recipes_name";
$query_limit_Recipe_list = sprintf("%s LIMIT %d, %d", $query_Recipe_list, $startRow_Recipe_list, $maxRows_Recipe_list);
$Recipe_list = mysql_query($query_limit_Recipe_list, $Recipes) or die(mysql_error());
$row_Recipe_list = mysql_fetch_assoc($Recipe_list);
if (isset($GET['totalRows_Recipe_list'])) {
$totalRows_Recipe_list = $GET['totalRows_Recipe_list'];
} else {
$all_Recipe_list = mysql_query($query_Recipe_list);
$totalRows_Recipe_list = mysql_num_rows($all_Recipe_list);
}
$totalPages_Recipe_list = ceil($totalRows_Recipe_list/$maxRows_Recipe_list)-1;
?>
and this is in the body sections
<h1>Recipes</h1>
<table width="700" cellpadding="4">
<?php do { ?>
<tr>
<th scope="col" align="left"> <?php echo $row_Recipe_list['recipes_name']; ?> </th>
</tr>
<?php } while ($row_Recipe_list = mysql_fetch_assoc($Recipe_list)); ?>
</table>
<p> </p>
</div>
<div id="footer">
<p>© 2008 Cats Designs </p>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recipe_list);
?>
So this displays the following:
Apple Pie
Banana Pudding
Berry Cupcakes
Chocalate Chip Cookies
Coconut Shrimp
Pancakes
When one of the above is clicked, i want the recipe for it to be displayed below the title(like apple pie, for example). How do i do that? i tried it a few different ways, but it always gives me errors. My table in the database has 3 parts: the recipes_id, recipes_name, and the_recipe. So the above list is the recipes_name, and when soemone clicks on that, i need the 'the_recipe' displayed. I would really appreciate if anyone could help. Thanks in advance.