This is my table which contain two column named router and routet_Desc.
-----------------------
router routet_Desc
r1 a
r1 b
r1 c
r1 d
Then i wanna select that all routet_Desc according to router name.How can i do that..?
If i select r1 result should be a,b,c,d.I wanna put those result to array.How can i do that..?
if $router=array();
i wanna get $router[0]=a ,$router[1]=b.......etc
Please help me to do this..
Thanking you alll
How can i select multiple values from DB..?
Moderator: General Moderators
Re: How can i select multiple values from DB..?
What have you got so far?
What database are you using?
What database are you using?
Re: How can i select multiple values from DB..?
This is my query for mysql Database
$Select_VirtualRouters=mysql_query("SELECT routet_Desc FROM table_name WHERE router='r1' ");
while (list($vrouter)=mysql_fetch_array($Select_VirtualRouters))
{
echo $vrouter;
}
I got the out put : abcd , that is mean all router_Desc as list/string.
but i wanna get out put as array. That is mean Myarray[0]=a , Myarray[1]=b ,Myarray[2]=c ,Myarray[3]=d
because i'm going to assign those router_Desc to four string variables.
Thank you
$Select_VirtualRouters=mysql_query("SELECT routet_Desc FROM table_name WHERE router='r1' ");
while (list($vrouter)=mysql_fetch_array($Select_VirtualRouters))
{
echo $vrouter;
}
I got the out put : abcd , that is mean all router_Desc as list/string.
but i wanna get out put as array. That is mean Myarray[0]=a , Myarray[1]=b ,Myarray[2]=c ,Myarray[3]=d
because i'm going to assign those router_Desc to four string variables.
Thank you
Re: How can i select multiple values from DB..?
Try changing your while loop to this:
Code: Select all
while ($result=mysql_fetch_array($Select_VirtualRouters)) {
Myarray[]=$result['routet_Desc'];
}Re: How can i select multiple values from DB..?
Thank you very much friend......it was grt......really thanking you again..
Wishing you all the best in future...
TC..
Wishing you all the best in future...
TC..