Welcome Guest, Not a member yet? Register   Sign In
How to avoid the string conversion
#1

[eluser]ReyPM[/eluser]
Hi, I've this code:
Code:
public function get_received() {
    $this->db
            ->select('p.*, rcp.*, msg.*')
            ->distinct()
            ->join($this->db->dbprefix('recipient') . ' rcp', 'rcp.user_id = ' . (int) $this->current_user->id)
            ->join($this->db->dbprefix('profiles') . ' p', 'p.user_id = ' . (int) $this->current_user->id)
            ->join($this->db->dbprefix('messages') . ' msg', 'msg.id = rcp.message_id')
            ->order_by('msg.date');

    return $this->db->get($this->db->dbprefix('messages'))->result();
  }
But this cause this error:
Quote:A Database Error Occurred
Error Number: 1054
Unknown column '1' in 'on clause'
SELECT DISTINCT `p`.*, `rcp`.*, `msg`.* FROM (`default_messages`) JOIN `default_recipient` rcp ON `rcp`.`user_id` = `1` JOIN `default_profiles` p ON `p`.`user_id` = `1` JOIN `default_messages` msg ON `msg`.`id` = `rcp`.`message_id` ORDER BY `msg`.`date`

Filename: /var/www/html/cmv/addons/default/modules/messages/models/messages_m.php
Line Number: 31
Because automatically convert the 1 to '1' meaning convert from INT to STRING and I don't want that, how to avoid this behaviour?
Cheers


Messages In This Thread
How to avoid the string conversion - by El Forum - 04-30-2012, 06:43 AM
How to avoid the string conversion - by El Forum - 04-30-2012, 06:58 AM
How to avoid the string conversion - by El Forum - 04-30-2012, 07:01 AM
How to avoid the string conversion - by El Forum - 04-30-2012, 07:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB