/    Sign up×
Community /Pin to ProfileBookmark

An easier way?

I made a database for my wife to store her recipes and a php form that will allow her to put them into the database.

I have a php page that will display the recipes according to the title or name of the recipe. The title or name that is displayed is also a link to a php script that will display that recipe. Here’s an example of the php script:

[B]<?
include(“top.php”)
?>

<?
$query=”SELECT * FROM recipes WHERE category=’Casseroles’ AND name=’Chicken and Rice Casserole'”;
?>

<?
include(“bottom.php”)
?>[/B]

[B]The problem[/B]: I’m having to write a new php script for each new recipe and link to it in order to display a recipe.

Is there a better way of doing this so that it is completely user friendly and will not require involvement on my part outside of the initial setup?

She has bunches and bunches of recipes folks – so please help if you can.

Thanks,
David

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SheldonMay 28.2006 — sure there is

You can display a list of all the stored recipes
[code=php]
<?php
$select all
$query($select)

echo("<ul>');
while(row = $query){
/* none of that is correct php */

echo("
<li><a href="show.php?category=".$row['category']."&amp;name=".$row['name'].">".$row['category']."&gt;".$row['name']."</a></li>
");

} // end while
[/code]


and on show.php
[code=php]
<?
include("top.php")
?>

<?
$cat = $_GET['category'];
$name = $_GET['name'];
$query="SELECT * FROM recipes WHERE category='".$cat."' AND name='".$name." ' ";
?>

<?
include("bottom.php")
?>
[/code]



Oh course you could add alot of checking on those
×

Success!

Help @DavidAP spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...