Reply to retrieving multiple rows advice

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация