hi,
for example:
I have 2 table with the following information:
table1
1) name
2) countries
table2
1) country_id
2) country_name
You can select your favorites country from table2 and save the countries by the following format:
1,2,3,4
for example:
1 = iraq
2 = usa
3 = germany
4 = canada
I want to get (all) your favorites countries by one query.
i use the following code and i don't have any problem, but it's running (n) query.
$db_connect->start_mysql_connection();
$DB->exe_query("SELECT countries FROM favorites_countries WHERE my_favorites_countries = 1");
$s1 = mysql_result($DB->query_result, 0,0);
$s2 = array($s1);
$i = 0;
foreach ($s2 as $c){
$aa = explode(',', $c);
for ($i == 0; $i <= count($aa); $i++){
$DB->exe_query("SELECT * FROM countries_table WHERE country_id = $aa[$i]");
while($row = @mysql_fetch_array($DB->query_result)){
echo $row['country_name']." - ";
} // while
}
}
thank you!