[PHP-DB] is this possible in one query?

2006-01-14 Thread Sjef Janssen
Hi there,
I have a table that keeps names for different language codes.
In a short example:
nameId name languageCode
31 House EN
31 Wohnung DE
32 Piece En
32 Stuck De
33 Car EN
33 PKW DE

What I would like is to have a query that returns for example:
nameId = 31
Names = House - Wohnung

Maybe I can even have a result that consists of an array with nameIds and
Names.
Or should I fire a bunch of queries after each other to have this result?

I use mysql and php 4.3.8

Tnxs!!

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] is this possible in one query?

2006-01-14 Thread RaJeSh VeNkAtA

u can have the query as

$query =  select * from $table where nameId = 31  ;

$result = mysql_query ( $query ) ;

$i = 0 ;

while ( $row   = mysql_fetch_array( $result , MYSQL_NUM ) )
{
$array[$i][0] = $row[0] ;
$array[$i][1] = $row[1] ;
$array[$i][2] = $row[2] ;
$i++
}

// now $array  has ur required names :-)


rajesh



On Sat, 14 Jan 2006, Sjef Janssen wrote:


Hi there,
I have a table that keeps names for different language codes.
In a short example:
nameId name languageCode
31 House EN
31 Wohnung DE
32 Piece En
32 Stuck De
33 Car EN
33 PKW DE

What I would like is to have a query that returns for example:
nameId = 31
Names = House - Wohnung

Maybe I can even have a result that consists of an array with nameIds and
Names.
Or should I fire a bunch of queries after each other to have this result?

I use mysql and php 4.3.8

Tnxs!!




--

Your absence should be long enough so that someone miss you ,
But it shouldn't be so long enough that
Someone learns to live without you
So keep in touch !

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php