QF_livesearch + mdb2
| From: | Köteles Zoltán | Date: | Thu, 29 Nov 2007 21:03:39 +0000 |
| Subject: | QF_livesearch + mdb2 | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-28241@lists.php.net to get a copy of this message | ||
Hello,
How can I use the QuickForm livesearch package with mdb2. I'd like to search with QF_livesearch in a mdb2 resultset.
I try this:
class livesearch {
/**
* Items to search against
*/
var $livesearch = array();
function getHotels() {
$query = "
SELECT hotel_id,
hotel_name
FROM Hotels
WHERE is_deleted = '0'
ORDER BY hotel_name
";
$result =& $mdb2->query($query);
while ($row = $result->fetchRow()) {
$this->livesearch[$row['hotel_id']] = $row['hotel_name'];
}
return $this->livesearch;} /**
* Perform a search
*
* @return array
*/
function getHotelName($input) {
$ret = array();
foreach($this->livesearch as $key => $value) {
if (stristr($value,$input)) {
$ret[$key] = $value;
}
}
return $ret;
}
}
Of course, it's not working. How can I add for the livesearch my mdb2 connection. Or is this wrong way?
Thanks a lot
ZoTyA