Welcome Guest, Not a member yet? Register   Sign In
simple question about select .. where
#1

Good day!

This is my table 'test'

CREATE TABLE `test` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `n` varchar(100) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8

id | n
2 | 2
3 | 123

This is my code
 
PHP Code:
       $query $this->db->select('*')->where('id',$id)->get('test');
 
       return $query->result_array(); 


This is result

id = '3'

array(1) {
 [0]=>
 array(2) {
   ["id"]=>
   string(1) "3"
   ["n"]=>
   string(3) "123"
 }
}

id = '3r'
array(1) {
 [0]=>
 array(2) {
   ["id"]=>
   string(1) "3"
   ["n"]=>
   string(3) "123"
 }
}


Why? Whe not empty or error? Thank you
Reply
#2

(This post was last modified: 05-22-2019, 07:57 AM by php_rocs.)

@Sarog,

Why you are receiving a record: https://stackoverflow.com/questions/1678...with-index
Try this: http://sqlfiddle.com/#!9/101556/5

Echo out the executed SQL statement so we can see exactly what is being sent to the database.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB