1
Hi XOOPSers im a php newbie
..i have converted my php simple directory application to xoops module but im stuck with xoops search
i have this search query in my page module... which is working fine
global $xoopsDB;
$result = "SELECT * FROM ".$xoopsDB->prefix("directory_info")." where name like '%" . $_POST['search'] . "%' or department like '%" . $_POST['search'] . "%' or unit like '%" . $_POST['search'] . "%' or position like '%" . $_POST['search'] . "%' ORDER BY name";
but now i want to integrate the xoops search (mysite.com/search.php) in my module instead of using own search in my php page
what i did so far
in xoops_version.php
// Search
$modversion['hasSearch'] = 1;
$modversion['search']['file'] = "include/search.inc.php";
$modversion['search']['func'] = "directory_search";
function directory_search()
{
global $xoopsDB;
$result = "SELECT * FROM ".$xoopsDB->prefix("directory_info")." where name like '%" . $_POST['search'] . "%' or department like '%" . $_POST['search'] . "%' or unit like '%" . $_POST['search'] . "%' or position like '%" . $_POST['search'] . "%' ORDER BY name";
$ret = array();
$i = 0;
while($myrow = $xoopsDB->fetchArray($result)){
$ret[$i]['image'] = "images/size2.gif";
$ret[$i]['link'] = "staff.php?cid=".$myrow['log_id']."";
$ret[$i]['title'] = $myrow['name'];
$i++;
}
return $ret;
}
can someone help me to correct my code
i just want to be able to search by name, position, department and unit in the xoops search
and the search result to show matching name in the directory
without showing name of submitter (user id)...
sorry for my english