Jump to content
  • 0
Brynner

Problem with searching.

Question

i just want to put a search engine that can search both item id or item name.

but my problem is.

 

 

before when i try to search item using item id. nothings happen. but when i try to search using item name the search works fine.
but after i add this. the problem has been change. 
when i try to search using item id it works now. but when i try to search using item name. nothings happen now.
 
<?phpif (!defined('FLUX_ROOT')) exit;$item_name = trim($params->get('item_name'));if($item_name == ''){    $this->redirect('?module=search_error&error_id=1');}elseif(strlen($item_name) < 4){    $this->redirect('?module=search_error&error_id=2');    }else{    $sql = "SELECT * FROM item_db_re WHERE name_japanese LIKE ?";+	$sql = "SELECT * FROM item_db_re WHERE name_english LIKE ?";+	$sql = "SELECT * FROM item_db_re WHERE id LIKE ?";    $sth = $server->connection->getStatement($sql);    $sth->execute(array("%$item_name%"));                 $item_res = $sth->fetchAll();        if(!$item_res)     {                $sql = "SELECT * FROM item_db2 WHERE name_japanese LIKE ?";+		$sql = "SELECT * FROM item_db2 WHERE name_english LIKE ?";+		$sql = "SELECT * FROM item_db2 WHERE id LIKE ?";        $sth = $server->connection->getStatement($sql);        $sth->execute(array("%$item_name%"));                     $item_res = $sth->fetchAll();                if($item_res)        {            $this->redirect('?module=search_error&error_id=3');        }    }    }?>

 

Edited by bgamez23

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Maybe check if its string or number??(if you are trying to use kRO data, since some custom items of pServer may have numbers as name)

if (isstring($name_or_id) == true){$sql = "SELECT -x-x-x-x-x WHERE `name_english` LIKE -x-x-x-x"}else{$sql = "SELECT -x-x-x-x-x WHERE `id` LIKE -x-x-x-x"}
Edited by Dastgir Pojee

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.