manipulating database result set
Posted: Thu Apr 23, 2009 8:44 pm
Hi
I have a table with three columns like this
id Instance Alias
1 Adam John
2 Adam Smith
3 Dave Black
4 Dave Peter
I want to join each 'Instance' with their 'Alias' as follows (Number of Alias for each Instance vary)
Adam John Smith
Dave Black Peter
I am getting databse reults as follows. But stuck to retrieve as per required format.
// Code
$result = mysql_query("SELECT * FROM chv_term_excel");
while ($row = mysql_fetch_array($result)) {
echo "ID: ".$row['id'].", Instance:".$row['Instance'] .", Alias:".$row['Alias']."<br/>";
}
Pls help
Thanks
Mehnaz
I have a table with three columns like this
id Instance Alias
1 Adam John
2 Adam Smith
3 Dave Black
4 Dave Peter
I want to join each 'Instance' with their 'Alias' as follows (Number of Alias for each Instance vary)
Adam John Smith
Dave Black Peter
I am getting databse reults as follows. But stuck to retrieve as per required format.
// Code
$result = mysql_query("SELECT * FROM chv_term_excel");
while ($row = mysql_fetch_array($result)) {
echo "ID: ".$row['id'].", Instance:".$row['Instance'] .", Alias:".$row['Alias']."<br/>";
}
Pls help
Thanks
Mehnaz