Page 1 of 1
simple php question..
Posted: Mon Jun 12, 2006 11:50 pm
by oshen
hi...this is my 1st post.
i looked around the tutorials for help, but i think my question is so basic that i can't find an answer for it.
i'm trying to use PHP with a drop down box exactly like this:
http://alexisstrum.com/_objects/ipod/default.php
i understand most of the code, and i've implemented php in some basic ways in the past, but i don't understand these specfic "values" and how to store the actual content on each page?
what kind of file is being called up that is simply named "7" or "8".
thankyu.
apologies
Posted: Tue Jun 13, 2006 12:08 am
by oshen
me, again.
ignore my question. i realize i know nothing..no need to waste your time.
i'm going to dig into some tutorials and try to learn myself and then post again if i still can't figure it out.
thanks.
Posted: Tue Jun 13, 2006 1:08 am
by John Cartwright
You are not wasting your time at all, this is a very valid question and we will be happy to assist you.
From looking at that site, it doesn't look like it is including any files.. possibly making database calls of menu items with the correlating ID which is found in the url.
A very simple example would be
Code: Select all
//lets grab a valid number for our very
$id = (isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : 1)
$result = mysql_query('SELECT * FROM `menu_items` WHERE `parent_id` = '.$id);
// fetch the results
while ($row = mysql_fetch_assoc($result))
{
// display each menu item
}
Do let us know if you need anything clarified to expanded upon.
thankyou
Posted: Tue Jun 13, 2006 9:40 am
by oshen
thanks Jcart. i sincerely appreciate your help.
i've just built this website for my band:
http://violetnine.com
i'm trying to learn new and better ways of doing things.
i normaly just put everything inside one large HTML file...as you'll see.
then, i noticed websites that will use PHP pages and i'm not sure why.
what is the advantage of using them?
i know they are good for more complicated tasks, but i don't know what the advantage is to using PHP when the file you are making is just a simple webpage with basic content.
specifically in examples like these:
http://motioncitysoundtrack.com/news.php
http://anberlin.com/index2.php?AllNews
you can ignore any "flash" stuff. i'm just trying to understand why it's a PHP file and not an HTML.
my guess is that somehow using PHP, you can update the "news" section more easily???
or is it essentially doing the same thing?
thanks very much,
tom
Posted: Tue Jun 13, 2006 10:28 am
by TheMoose
They use PHP because they can then post new content without having to modify the source code for every page. It allows for more dynamic content that's easier to update.
Posted: Tue Jun 13, 2006 10:39 am
by pedrotuga
in an easy and simpefied way: php is used to generate html acording on the content.
The content is stored usualy on a database (mysql, postgres, or others) or in text files.
google for "php connect a mysql database"
or "php guesbook tutorial"
it's not at all as dificult as most think.
All of us are here to help and be helped so post you questions
BTW great site
ah..
Posted: Tue Jun 13, 2006 11:41 am
by oshen
thanks for the help you two.
that all makes sense, and was what i had assumed.
seems nice to be able to update content more easily that way.
i'll google what you mentioned and then read up on it more.
if i can't figure it out, i'll ask more questions.
thanks!
tom