In this script:
if (isset($type)) {
switch ($type){
case 'forum':
$where='forum';
$field1='title';
$field2='content';
dosearch($where);
break;
case 'oforum':
$where='open_forum';
$field1='title';
$field2='content';
dosearch($where);
break;
case 'headlines':
$where='headlines';
$field1='title';
$field2='news';
dosearch($where);
break;
case 'news':
$where='news';
$field1='title';
$field2='summary';
$optional ="AND post ='yes'";
dosearch($where);
break;
}
}
function dosearch($where){
global $field1, $field2, $type, $query, $optional;
echo $where; /// $where does nto echo, query does not work, but will work with type
$query="SELECT * from $where";
$query1=mysql_query($query);
$count=mysql_num_rows($query1);
echo $count;
}
can you see why the variable is disappearing?