$limit=200;
function print_question($row) {
$row['tFileName']=str_replace('.txt','',$row['tFileName']);
$row['t1FileName']=str_replace('.txt','',$row['t1FileName']);
foreach ($row as $k=>$v) {
$row[$k]=preg_replace('/\(pic: ([^\)]*)\)/','
',$v);
$row[$k]=preg_replace('/^\|([^\n]*)/','
$1
',$row[$k]);
$row[$k]=preg_replace('/^\s+/ms','
',$row[$k]);
}
include "question_template.php";
}
function print_questions_sql($sql,$search=false) {
$res=mysql_query($sql) or print mysql_error().$sql;
print_questions_res($res,$search);
}
function print_questions_res($res,$search=false) {
global $limit;
$kvo=mysql_num_rows($res);
if ($search) {
if ($kvo==$limit) {
print "More than $limit results";
} else print "$kvo results";
while ($row=mysql_fetch_assoc($res)) {
print_question($row);
}
}
}
?>