Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 07-24-2005, 06:07 PM
  #1
azanaz
Fighter (Level 4)
 
azanaz's Avatar
 
Join Date: Jul 2005
Posts: 38
iTrader: (0)
azanaz is an unknown quantity at this point
Lightbulb PHP drop down menu

Hi All, I am back with some new problems. I need to generate a drop down menu from a sql database and i have looked everywhere i can't get what i want. Here is an example of what i would like

Age selection in drop down menu will be ranges from 0-10 yrs. Depending from this selection the sql database will know how many products is left in the chosen age..
I have the same product but in different age, some I have 1 some 2 some 3 and so on...


Am i making any sence here... I am geting confused too...
I will love you forever if anyone can comeup with a scipt for me.

Azanaz

Last edited by azanaz : 07-24-2005 at 07:36 PM. Reason: Wrong Title??
azanaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 05:18 AM
  #2
azanaz
Fighter (Level 4)
 
azanaz's Avatar
 
Join Date: Jul 2005
Posts: 38
iTrader: (0)
azanaz is an unknown quantity at this point
I see I'm Making it hard, I need to know if its possible at all to create a table in my sql thathas the number of available items so that when one chooses it from the main website from a pull down menu the database automatcally know which size is being purchased. E.G this is the sql table i need:

ProductsID Units In Stock Product Description
1 1 size 9
2 1 size 10
3 2 size 11
4 1 size 12
5 1 Size 13
6 2 size 1
7 1 size 2


Pull down Menu: Size E.g Sizes 9,10,11,12,13,1,2 in a box.

Please please please you all, i really need to finish the website soon..

Many MAny Thanks for looking
Azanaz

Last edited by azanaz : 07-25-2005 at 06:40 AM.
azanaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 06:23 AM
  #3
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
iTrader: (0)
Horus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of light
you could have two fields - one for upper age limit of a product and one for the lower age limit.

Then, if the select value is between those two fields, you can query for them:

Code:
$query = "SELECT * FROM products WHERE upper_age > ". $selected_age ." AND lower_age < ". $selected_age;
I've used PHP variable identifiers, as I am not sure what language you are using....
__________________
New Photo Gallery: Modus InOperandi
Personal Blog: HorusKol
Articles on Programming and Development (PHP/HTML/CSS, C/C++, more): RandomTweak
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 07:16 AM
  #4
azanaz
Fighter (Level 4)
 
azanaz's Avatar
 
Join Date: Jul 2005
Posts: 38
iTrader: (0)
azanaz is an unknown quantity at this point
Hi, Many Thanks, I am very very newbie here, At least there is someone out there who knows what i mean but i am still very confused as to what the code mean...could you pls explaine to me where i should put this code, I mean i know what i want but i can't get it round my head how to...I know you must be laughing now, but i am very determined to complete this thing and i know with help from you guys i will manage.

God Bless
Azanaz

P.s: I am using php. Many thanks.
azanaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 07:46 AM
  #5
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
iTrader: (0)
Horus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of light
Okay, I'm getting a sense of "running before walking" here - don't worry about laughing, as we don't do that round here... well, we do.. but only when someone says something funny - not when you're asking questions like this... I used to ask questions like this, too...

anyways...

Do you know how to alter the table in the database so that you have the two fields?

Do you know how to connect your PHP script to the database?

Do you know how to write queries?

Answer those, and we can work from there
__________________
New Photo Gallery: Modus InOperandi
Personal Blog: HorusKol
Articles on Programming and Development (PHP/HTML/CSS, C/C++, more): RandomTweak
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 08:02 AM
  #6
azanaz
Fighter (Level 4)
 
azanaz's Avatar
 
Join Date: Jul 2005
Posts: 38
iTrader: (0)
azanaz is an unknown quantity at this point
Ok, I feel very stupid, i have been using books and online resources for now, i don't know a thing about PHP. I started out with html but since opening an accoung with oscommerce everything is in php so i haven't had the time to have lessons....Hope you can help, I am tring hard to make the website and your help would be very much appreciated.

Many Thanks
Azanaz
azanaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 09:15 AM
  #7
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
iTrader: (0)
Horus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of light
hey - no need to feel stupid... you're just new to it... if you can't get to grips with it before the universe is sucked into a black hole, then you may just be dumb - but not being able to do something when you're starting out is fine (even I ask the odd question now and then, and I've been at this for years now).

Okay...

You need to find out if your PHP package on your server also includes a database (I assume it does).

http://uk2.php.net/manual/en/ref.mysql.php is the main reference for using PHP and MySQL, you don't need to worry about the installlation - your host will have sorted that out.

The other reference is the MySQL site itself - http://dev.mysql.com/doc/mysql/en/index.html

Start simple, and then expand

I can help with specific questions, but it's better for you to have a go first and then try and figure out why it breaks for yourself before posting questions.
__________________
New Photo Gallery: Modus InOperandi
Personal Blog: HorusKol
Articles on Programming and Development (PHP/HTML/CSS, C/C++, more): RandomTweak
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 09:36 AM
  #8
azanaz
Fighter (Level 4)
 
azanaz's Avatar
 
Join Date: Jul 2005
Posts: 38
iTrader: (0)
azanaz is an unknown quantity at this point
Yes I already have a sql database running, Luckily the ecommerce i use which is OS commerce comes preety much done, i just had to edit a few bits and pieces, The problem i am having is because it's already premade, i cannot seem to add things to it. Can I pm you with the site adddress coz my admin is not password protected at the moment and i am working on that, just not getting anywhere... If you go to the oscommerce page you will see all my products that i have(actually only 3) Because the rest i need to put them up but with the age selection drop down.
azanaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 10:11 AM
  #9
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
iTrader: (0)
Horus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of light
go ahead and PM - I'll have a quick look tonight... just two things - I won't promise anything as far as fixing it goes (I do have a life outside of here too ) and I really recommend you close up that security hole by sorting your access out...
__________________
New Photo Gallery: Modus InOperandi
Personal Blog: HorusKol
Articles on Programming and Development (PHP/HTML/CSS, C/C++, more): RandomTweak
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2005, 12:16 PM
  #10
azanaz
Fighter (Level 4)
 
azanaz's Avatar
 
Join Date: Jul 2005
Posts: 38
iTrader: (0)
azanaz is an unknown quantity at this point
ok I have pm you, Many Thanks for ur help!!

azanaz
azanaz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 11:15 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.