You mean something like this:
function getTemplates($theme, $templates){
$templates = str_replace(',', '\',\'', $templates);
$limit = count(explode(",", $templates));
for($i = 0; $i < $limit; $i++){
$string .= "OR tmp_code = '{$templates[$i]}' ";
}
$q = mysql_query("SELECT SQL_BIG_RESULT * FROM tbltemplates WHERE tmp_theme = '{$theme}' {$string} LIMIT {$limit}") or die(mysql_error());
$r = mysql_fetch_array($q);
return $r;
}
It only fetches the last template specified. Right now I'm using the one below, it works great, but I uses too many queries:
function getTemplates($theme, $temps=array()){
foreach(explode(",", $temps) as $tempname){
$q = mysql_query("SELECT tmp_code, tmp_output, tmp_theme FROM tbltemplates WHERE tmp_theme = '{$theme}' AND tmp_code = '{$tempname}'");
$r = mysql_fetch_array($q);
$r['tmp_output'] = stripslashes($r['tmp_output']);
$cache[$tempname] = $r['tmp_output'];
}
return $cache;
}