Need help troubleshooting search in PHP.

SpaceshipSpaceship
Watch

MicroGuy

Miembro EspecialTop Member
Impact
1,493
This is a snip of PHP code that is not working properly.

The search form is displayed but "Nothing was found by your request. Try to redefine search terms" is returned when searching by string. The search by date part works great?

Any help you be greatly appreciated.

PHP:
function display_search_form(){
    global $db, $t;

    $t->assign('az', get_az());

    $products = & $db->get_products_list();
    $pp = array();
    foreach ($products as $p) $pp[ $p['product_id'] ] = $p['title'] ;
    $t->assign('products', $pp);

    $user_fields = array();
    foreach ($GLOBALS['member_additional_fields'] as $f){
        if ($f['name'] == 'is_locked') continue;
        if ($f['name'] == 'i_agree') continue;
        if ($f['name'] == 'is_approved') continue;
        if ($f['type'] == 'hidden') continue;
        $user_fields[$f['name']] = $f['title'];
    }
    $t->assign('member_fields', $user_fields);

    $t->display('admin/user_search.html');
}

function search_by_string(){
    global $q, $q_where;
    global $db, $t;
    $ul = & $db->users_find_by_string($q, $q_where);
    if (count($ul) == 0){
        $t->assign('error', 'Nothing was found by your request. Try to redefine search terms');
        display_search_form();
        return;
    }
    global $all_count, $count, $start;
    $all_count = count($ul);

    $ul = @array_slice($ul, $start, $count);
    $t->assign('ul', $ul);

    $t->display('admin/user_search_res.html');
}

function search_by_product(){
    global $product_id, $include_expired;
    global $db, $t;
    $ul = & $db->users_find_by_product($product_id, $include_expired);
    if (count($ul) == 0){
        $t->assign('error', 'Nothing was found by your request. Try to redefine search terms');
        display_search_form();
        return;
    }
    global $all_count, $count, $start;
    $all_count = count($ul);

    $ul = @array_slice($ul, $start, $count);
    $t->assign('ul', $ul);

    $t->display('admin/user_search_res.html');
}

function search_by_date(){
    global $search_type;
    global $db, $t;
    set_date_from_smarty('date', $_GET);
    $ul = & $db->users_find_by_date($_GET['date'], $search_type);
    if (count($ul) == 0){
        $t->assign('error', 'Nothing was found by your request. Try to redefine search terms');
        display_search_form();
        return;
    }
    global $all_count, $count, $start;
    $all_count = count($ul);

    $ul = @array_slice($ul, $start, $count);
    $t->assign('ul', $ul);

    $t->display('admin/user_search_res.html');
}
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Anyone....I'll pay $$.
 
0
•••
the code you provided really is not going to help at with finding the problem.

Try finding the sql and echoing this out, it is possible it is invalid
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back