• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stumped on this one.. (SQL stuff)

#4
[eluser]Peter Goodman[/eluser]
Code:
$qs = array_pad(array(), count($_POST['SubArea']), '?');
$sql = "SELECT * FROM some_table WHERE subarea IN (". implode(',', $qs) .")";
$this->db->query($sql, $_POST['SubArea']);

What this does is it creates an array of question marks, implodes and hence comma separates them and puts them into the query, then lets CI substitute the real values in for each question mark.


Messages In This Thread
Stumped on this one.. (SQL stuff) - by El Forum - 07-19-2007, 02:00 PM
Stumped on this one.. (SQL stuff) - by El Forum - 07-19-2007, 02:06 PM
Stumped on this one.. (SQL stuff) - by El Forum - 07-19-2007, 02:10 PM
Stumped on this one.. (SQL stuff) - by El Forum - 07-20-2007, 12:50 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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