|
Posted by julian_m on 11/22/05 07:36
let's say I've an array of articles's id
$arr_art_id=(1, 551, 2015, 6 .......n )
what option is better (1 or 2), in order to achieve better performance?
(pseudo code)
1)
for i=0 to array count{
select * from articles where articles.id=$arr_art_id[i]
mysqlquery($sql)
//do whatever i have to do
}
2)
$or ='';
for i=0 to array count{
$sql.= $or . 'articles.id='. $arr_art_id[i];
$or ='or';
}
$sql = 'select * from articles where' .$sql
mysqlquery($sql)
//do whatever i have to do
tia
regards - julian maisano
Navigation:
[Reply to this message]
|