Jump to content

barkster

Members
  • Posts

    194
  • Joined

  • Last visited

Everything posted by barkster

  1. I have a query like this where I'm trying to query all columns for any matching value but when I try and do my job_number field it will not find any results. SELECT * FROM tasks WHERE MATCH (job_number,client_name) AGAINST ('+097' IN BOOLEAN MODE) taskid job_number client_name 1 21-097 Birch 2 22-884 Smith When I run the query it will not find any tasks matching 097 but will find birch... any ideas. All columns are set to text type
  2. Appreciate all the help, FULLTEXT INDEX does look easier... I'll look at that also
  3. Hey awesome, what was I doing wrong. Looks so similar
  4. I need to query all the fields in the table for multiple keywords. For instance I need to query for "white river" but white and river can be in any of the fields. How can I do this? I'm pretty close here but not exactly right. function queryall($table, $keyword) { $result = mysql_list_fields($this->db,$table); $sql = "SELECT * FROM ".$table." WHERE "; $keywords = explode(' ', $keyword); foreach ($keywords as $kw) { for($i = 0; $i < mysql_num_fields($result); $i++){ if($i!=0) { $kw = get_magic_quotes_gpc() ? trim($kw) : addslashes(trim($kw)); $where[] = mysql_field_name($result,$i)." LIKE '%$kw%'"; } } $whereclause[] = join(" \nOR ", $where); } $sql = $sql . join(" \nAND ", $whereclause); return $sql; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.