• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting a query using the Query Builder

I have a query that right now is just a regular query executing via query(), I wanted to convert it using the Query Builder class

Heres the query as is:
PHP Code:
self::$db->query("UPDATE {$partition_table} SET {$column_name}=REPLACE({$column_name}, '{$current_value}', '{$new_value}') WHERE FIND_IN_SET('{$current_value}', {$column_name}) > 0" 

And that works fine, This is what I tried to convert it to:
PHP Code:
->where("FIND_IN_SET('{$current_value}', {$column_name}) >"'0')
set($column_name"REPLACE({$column_name}, '{$current_value}', '{$new_value}')")

And while that doesn't throw any errors, it will clean out the contents of any row it attempts to update...

Any idea what im doing wrong?

P.S. Before anyone says that it might be how I'm trying to use FIND_IN_SET, I've gotten it to work before, like so:
PHP Code:
$query self::$db
->where_in('page_id', (is_array($pages) ? $pages : [$pages]))
where("FIND_IN_SET('{$partition}', partitions) >"'0')

Messages In This Thread
Converting a query using the Query Builder - by jLinux - 09-18-2015, 07:43 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.