Welcome!

I hope you find what you're looking for. If you have any questions or anything at all, please email me at: sooj_doesnt_know@hotmail.com

Sunday, 19 September 2010

PHP Blog Week 10



This week, I actually had a minor break through. Well, I actually studied and learned how to join tables. And I remember Kirk saying that Join is awesome, and it totally is. Also I have simplified my tables. I should really say I went through the normalization process :)


Below is my ERD. It should have been submitted to moodle earlier but when I went through the noramilization I had to change a few things around and remove a few tables to simplify! it turns out I went through the process more than needed.




So my query to search for a certain pizza with a certain topping looks like this:


SELECT item_name, toppings,

TYPE FROM items

NATURAL JOIN pizza_topping

WHERE MATCH(toppings) AGAINST ("mushroom");


I still havent figured out how to pull the size and price with the pizzas but I'm gonna post on here what I have been trying and it keeps getting an error. I should be able to figure it out by today. I shall be studying the books more deeply. It really did help. I am no longer so confused and lost!


SELECT item_name, toppings, price, size

FROM items

NATURAL JOIN pizza_topping,

pizza_size_price JOIN

price, size ON price_id = price.id, size.size_id

WHERE items.id = items_id;


I'm not sure whats wrong with that but the error i get back is: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON price_id = price.id, size.size_id WHERE items.id = items_id LIMIT 0, 30' at line 5


If I fix this, I will post another one to show what I did differently. Also I did the CSS and now it looks very similar to how I wanted it on the proposal.


I cleaned up my index page and really simplified everything. I put the navigation and all the rest of the html tags along with all the includes in the header.php file. so my index page looks like:




In the header.php file, since the title of each page needs to change dynamically, this is what my title looks like. at the moment when i first visit the index page, it says $page is not set and I'm not really sure why because $page is set to home by default.. I will look into that soon.




this is just a little preview of what it looks like right now. :P I still need to fix the CSS a little to look a bit better.





Until then, Ciao!


No comments:

Post a Comment

Saying Images

Saying Images
Images with words.