FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fetching value from related multiple rows & columns in PHP SQL
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
fetching value from related multiple rows & columns in PHP SQL [message #182521] Sat, 10 August 2013 05:50 Go to next message
vikas daiya is currently offline  vikas daiya
Messages: 2
Registered: August 2013
Karma: 0
Junior Member
I have database as follows. using SQL, PHP

Code Period Period2 type amount
14 4 2013 TP 500
14 5 2013 TP 300
14 6 2013 TP 175
13 4 2013 TP 150
13 5 2013 TP 50
13 6 2013 TP 250
12 7 2013 TP 110


I want to create a form with combos having

which will fetch values as follows.

code > period > period2 > type > amount

14 > 4 > 2013 > TP > 500

and so on.... same need to be updated / inserted in new table.

note: amount is related to type which is related to period2 which is related to period under code.

means under code "14" there are three values "4,5,6" under this there is one value "2013" (default) and "TP" (default) and amount under this there are values "500,300,175" so when code is sleeted i.e "14" then values 4,5,6 should fetched and then "2013" then "TP" but when period is selected i.e 5 then amount of 5 300 should be fetched.

kindly help me out to solve this query.
Re: fetching value from related multiple rows & columns in PHP SQL [message #182523 is a reply to message #182521] Sat, 10 August 2013 12:04 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 8/10/2013 1:50 AM, vikas daiya wrote:
> I have database as follows. using SQL, PHP
>
> Code Period Period2 type amount
> 14 4 2013 TP 500
> 14 5 2013 TP 300
> 14 6 2013 TP 175
> 13 4 2013 TP 150
> 13 5 2013 TP 50
> 13 6 2013 TP 250
> 12 7 2013 TP 110
>
>
> I want to create a form with combos having
>
> which will fetch values as follows.
>
> code > period > period2 > type > amount
>
> 14 > 4 > 2013 > TP > 500
>
> and so on.... same need to be updated / inserted in new table.
>
> note: amount is related to type which is related to period2 which is related to period under code.
>
> means under code "14" there are three values "4,5,6" under this there is one value "2013" (default) and "TP" (default) and amount under this there are values "500,300,175" so when code is sleeted i.e "14" then values 4,5,6 should fetched and then "2013" then "TP" but when period is selected i.e 5 then amount of 5 300 should be fetched.
>
> kindly help me out to solve this query.
>

This isn't a PHP question. You need to be asking in a SQL newsgroup,
or, more preferably, a newsgroup related to the database you are using.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Counter reset or not? UPDATE
Next Topic: Re: Counter reset or not?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 03:03:53 GMT 2024

Total time taken to generate the page: 0.02271 seconds