getting this functionality
Posted: Mon Jan 01, 2007 3:17 am
i have a player table with players(player_id,name) in mysql database
and i have game table(game_id,dates,players)
the players field is text filed
where the data is suppose to entered as
-1-5-4-7 .....ie id of the players who are playing...taken from the mutliselect box and used concatenation....(ie first biginning of page player="";
then after getting value from form players.=formplayer[] ....with for loop..there are 11players
after the players insertion into games table....
now i have a drop down box in which i want to diplay players name for a game who are playing in a drop down box..(entered in
player field of game table)
so for that i need to break each as
1
5
4
7 (removing - and take each as one value for query)
and use
select name from players where player_id=.....each one of those one by one
so how can i get this functionality
(make 1-4-5-7) breaking 1 4 5 7 and query for each name to display in drop down menu...
any idea or help
any function or breaking this effieciently and getting that functionality..i think the can be done with implode and explode but any efficient way of doing it and managing initail -
(i am storing as 1-4-7(string in text field) as string as it saves lots of space and donot need to enter row for each player
who is playing on a particular game,any suggestion)
and i have game table(game_id,dates,players)
the players field is text filed
where the data is suppose to entered as
-1-5-4-7 .....ie id of the players who are playing...taken from the mutliselect box and used concatenation....(ie first biginning of page player="";
then after getting value from form players.=formplayer[] ....with for loop..there are 11players
after the players insertion into games table....
now i have a drop down box in which i want to diplay players name for a game who are playing in a drop down box..(entered in
player field of game table)
so for that i need to break each as
1
5
4
7 (removing - and take each as one value for query)
and use
select name from players where player_id=.....each one of those one by one
so how can i get this functionality
(make 1-4-5-7) breaking 1 4 5 7 and query for each name to display in drop down menu...
any idea or help
any function or breaking this effieciently and getting that functionality..i think the can be done with implode and explode but any efficient way of doing it and managing initail -
(i am storing as 1-4-7(string in text field) as string as it saves lots of space and donot need to enter row for each player
who is playing on a particular game,any suggestion)