• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can't write strings to database

#1
[eluser]illuzionist[/eluser]
Hello everybody,

so I'm trying to write a string to the database and this is what I do..

I have a url just like this:
www.example.com/index.php/site/writeGPStoDatabase/?lat=45.7071587&lng=16.0575276

now what I do is I have a controller "site" and method inside called "writeGPStoDatabase", and from this method I try to write to database like this, but it won't work:

this is the code:
Code:
$locationGPS = $this->uri->segment(3);      
        
$query = 'UPDATE myTable SET time_D=current_time' . ',locationGPS=' . $locationGPS . ' WHERE id=' . $id;
$this->db->query($query);
and this code just won't work, if I change $locationGPS and put some other string it also doesn't work, it only works if I put in number values like "22002", "1113423" etc..

in SQL database locationGPS column is set to varchar(255)

TL;DR;
CI won't write strings to database if they contain letters, only if string is made up of numbers ONLY


Messages In This Thread
can't write strings to database - by El Forum - 07-14-2012, 11:11 AM
can't write strings to database - by El Forum - 07-14-2012, 11:24 AM
can't write strings to database - by El Forum - 07-14-2012, 11:25 AM
can't write strings to database - by El Forum - 07-14-2012, 11:35 AM
can't write strings to database - by El Forum - 07-14-2012, 12:04 PM
can't write strings to database - by El Forum - 07-14-2012, 12:28 PM
can't write strings to database - by El Forum - 07-14-2012, 12:43 PM
can't write strings to database - by El Forum - 07-14-2012, 12:47 PM
can't write strings to database - by El Forum - 07-14-2012, 12:50 PM
can't write strings to database - by El Forum - 07-14-2012, 01:08 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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