Prajakta
Prajakta

Reputation: 53

How to convert following query into codeigniter query

So This is the following query i want convert into codeigniter:

$q = "DELETE FROM  group_info, contacts

USING group_info INNER JOIN contacts 

WHERE group_info.gid = '$gid'

AND contacts.gid = group_info.gid";

Upvotes: 1

Views: 45

Answers (1)

Atural
Atural

Reputation: 5439

i don't think you can achieve this with the Query Builder properly

Instead - i'd suggest the following

$this->db->query("DELETE FROM  group_info, contacts USING group_info INNER JOIN contacts WHERE group_info.gid = ? AND contacts.gid = group_info.gid", array($gid));

In this case you are protected via bindings

You can find this exact information here

Upvotes: 1

Related Questions