Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:32:38+00:00 2026-06-09T09:32:38+00:00

public function searchItem($itemname) //search item based on itemname { $itemname = (string)$itemname; $select =

  • 0
public function searchItem($itemname) //search item based on itemname
{

    $itemname = (string)$itemname; 
    $select = $this->select() 
    ->from(array('item')) 
    ->where('itemname LIKE "%"?"%', $itemname);
    $row = $this->fetchAll($select);
    if (!$row) { //if row can't be found
        throw new Exception("Could not find row $itemname"); //Catch exception where itemid is not found


    }
    return $row->toArray();
}

Any idea on how to use the two ‘%’? I tried to use combinations of ‘ and ” but it doesnt work, cant figure out what to use. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:32:39+00:00Added an answer on June 9, 2026 at 9:32 am

    You can use \% to escape the percent sign.

    Note you can use PHPs mysql_real_escape_string to do this for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public function dcr() { $query = $this->db->query(SELECT * FROM church_repo); foreach ($query->result() as $row)
I have this query: public function checkUser($phone) { $sql = SELECT name FROM users
public function receiveDomainNames($keyword) { try { $stmt = $this->_dbh->prepare(SELECT d.someField FROM domain d WHERE
this is my query: public function getDetails($userid, $orderby, $sort){ $query = $this->_em->createQueryBuilder() ->select('u') ->from('\Entities\Users',
public function gl_popular(){ $query=$this->db->query(SELECT DISTINCT new_ques_id FROM gl_mark_ques); //echo SELECT DISTINCT new_ques_id FROM gl_mark_ques
public function genMenu($parent_id, $menu_type, $utype, $parent_token=0, $currentpage = 0) { $stmt = $this->db->prepare(SELECT n.page_id,
I have this code public function getList() { $array = array(); $r = mysql_query(
public function setSomething($what){ $this->something = $what; } ... $obj->setSomething(array('aaa', 'bbb', 'ccc')); or public function
This function: public function createMessage($post, $messagename) { $dbData = array(); // don't forget to
my action: public function executePreview(sfWebRequest $request) { $this->setLayout('layout_preview'); $text=''; $text= $request->getGetParameter('text'); $this->img=''; $this->img2=$this->createImage(array('font_size'=>10, 'line_spacing'=>1.5,'font'=>'dejavu',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.