Welcome Guest, Not a member yet? Register   Sign In
help me write this mysql query in codeigniter
#9

(11-12-2019, 09:27 AM)Piotr Wrote:
PHP Code:
Easiest way:

$q $this->db->query("SELECT *, ABS( post_code - 2015 ) AS distance FROM list_data WHERE business_name LIKE '%cash%' ESCAPE '!' ORDER BY distance LIMIT 6");

print_r($q->result()); 

Hi, @Piotr thank you for your reply, you forgot that 2015 and '%cash%' is coming from input fields so you can treat it as a string. Please look at the solution from @Chivinsdev, his solution is correct.
Reply


Messages In This Thread
RE: help me write this mysql query in codeigniter - by acebay - 11-12-2019, 03:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB