codeigniter


removing backslashes in the query using codeigniter mysql


Post value is multi select, means values are coming in the form of array
if(!empty($_POST['form_type']))
{
$test = implode("','",$_POST['form_type']);
$this->db->where_in('enquiry.type_of_enquiry',"'".$test."'");
}
my query is like this
SELECT `sobha_enquiry`.`name`, `sobha_enquiry`.`date_created`, `sobha_enquiry`.`company`, `sobha_enquiry`.`form_of`, `sobha_enquiry`.`projectname`, `sobha_enquiry`.`city`, `sobha_enquiry`.`country`, `sobha_enquiry`.`phone`, `sobha_enquiry`.`type_of_enquiry`, `sobha_enquiryzone`.`enquiry_id`, `sobha_enquiry`.`hearaboutus`, `sobha_enquiry`.`email`, `sobha_enquiry`.`comments`, `sobha_enquiry`.`address`, `sobha_admin`.`id`, `sobha_admin`.`city_id` FROM (`sobha_senquiry`) LEFT JOIN `sobha_enquiryzone` ON `sobha_enquiryzone`.`enquiry_id` =`sobha_enquiry`.`id` LEFT JOIN `sobha_admin` ON `sobha_admin`.`city_id`=`sobha_enquiryzone`.`city_id` WHERE `sobha_enquiry`.`type_of_enquiry` IN ('\'register form\',\'feedback form\'') GROUP BY `sobha_enquiry`.`id` ORDER BY `sobha_enquiry`.`id` desc LIMIT 15
since i used implode function it is coming like this IN ('\'register form\',\'feedback form\'') i want to remove those backslashes . Please help me
$this->db->where_in() will accept array as second argument.
So there is no need for imploding the data.
if(!empty($_POST['form_type']))
{
$this->db->where_in('enquiry.type_of_enquiry',$_POST['form_type']);
}
This will result as,
WHERE `enquiry`.`type_of_enquiry` IN ('register form','feedback form')
You can refer this link for more info, Codeigniter Active Record Documentation

Related Links

when I use If isset($_FILES['something'] I can't access my controller array in my view in codeigniter?
Unable to load the requested class Session in Codeigniter
resetting password in codeigniter
having trouble in join query in codeigniter
How to host a website with CodeIgniter on a server?
codeigniter Trying to get property of non-object
Codeigniter - Call to undefined function set_value()
Is it dbase is support on Codeigniter 3?
how to configure codeigniter hmvc in subdomain
Use like in join in codeigniter
Why does not work routing with regular expression in Codeigniter?
getting error while sending email with multiple attachment in codeigniter
CodeIgniter v3 + Smarty v3 SmartyCompilerException Error at form validation time
How the user id set as session during login in codeigniter and acess this userid to several function?
Can't Upload File (not select a file to upload)
Codeigniter: fatal error call to undefined function mysqli_init()

Categories

HOME
sbt
validation
serial-port
apache-pig
isis
oracle-adf
google-adwords
py.test
ceph
drag
silverlight
librsvg
proftpd
command-line-arguments
scrollbar
flow
durandal-2.0
media-source
sencha-touch-2
amazon-cloudfront
bitcode
typemock-isolator
number-formatting
phonegap-desktop-app
expression-trees
dapper-fastcrud
udid
localdb
django-users
reed-solomon
kube-dns
dlopen
google-shared-contacts
dashboard-designer
chamilo-lms
ecmascript-4
uistoryboardsegue
essbase
consistency
spark-submit
zfs
httpexception
integer-programming
rtems
ase
keyboard-maestro
kendo-chart
docker-swarm-mode
website-hosting
database-cleaner
angular-directive
waf
agile-processes
configuration-profile
gwt-material-design
angular2-rc5
ckcontainer
kernighan-and-ritchie
formatter
pager
vsvim
administrator
membership
axlsx
protected
spinach
cvc4
linegraph
javaw
gdk
publish-actions
globus-toolkit
controlsfx
bunny
nhunspell
custom-titlebar
mouseenter
couchrest
libtorrent-rasterbar
glulookat
gora
ccombobox
jquery-data
double-precision
nspersistentdocument
squirrelmail
timestamp-with-timezone
google-website-optimizer
adaboost
server.mappath
ember-router
payment-services
dired
replay
pong
cluetip
hunchentoot
renderaction
symstore
xoom
keylogger
non-relational-database
user-testing
roguelike

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App