Welcome Guest, Not a member yet? Register   Sign In
Easy migration from mysql syntax to CI syntax.
#1

[eluser]debow[/eluser]
I'm trying to covert this...

Code:
$sql = "UPDATE eresults set eventrank=NULL and eventscore=NULL";
    $res = sqlQuery($sql);
    return 99;

To this.. but below isn't working.
Code:
$this->db->update('eresults');
$this->db->set('eventrank','NULL');
$this->db->set('eventscore','NULL');
$this->db->where('event','100m');
$return $this->db->affected_rows();

Any suggestions. Thanks
#2

[eluser]TWP Marketing[/eluser]
Just offhand, change the order of your setup:
Code:
$this->db->set('eventrank','NULL');
$this->db->set('eventscore','NULL');
$this->db->where('event','100m');
$this->db->update('eresults');
$return $this->db->affected_rows();
#3

[eluser]CroNiX[/eluser]
should probably be NULL, not "NULL" since its not a string. And yes, the "update" or "insert" is what is actually triggering the query, so it should go very last so that the other operations get triggered.
#4

[eluser]debow[/eluser]
That worked, thank you.




Theme © iAndrew 2016 - Forum software by © MyBB