Sunday, August 17, 2008

The most complicated part

When I went and talked to Phil I suddenly realised where I had gone wrong. I had spent the last three weeks bogged down in trying to get the most complicated part of the web site functioning. I really should have started with the simplest part first - which was the search recipe form. Instead I was bogging myself down in something that required a bit more experience.

So, now that I have completed the easiest part of the site (the search_form.php) I am working on what I realise is the most complicated aspect of the site - the submit a recipe form and its dynamic function.

Phil spent a bit of time showing me what I needed to include in the code for this, and even gave me an idea of how I was to link the recipe_year_id into the recipe table. But I am still struggling with how to link the user_id into the recipe table.

The recipe_year_id is simple enough as the form asks for an identifying year within it and therefore allocates its id as $ry within the form. That allows me to connect an innitial $query of:

SELECT recipe_year_id FROM recipe_year WHERE recipe_year = '$ry' ,

which selects the correct recipe_year_id before I insert anything into the recipe table.

The category_id should be ok too as the form identifies the category it will be in - again allocating it as $r - and therefore can be inserted into the recipe table.

However, I also need to link the recipe to a user_id (as only users can submit recipes) and I am not sure how to do this.

Have tried a few things, but not even having any luck getting the submit.php page up without an error at the moment. Most frustrating!

No comments: