Welcome Guest, Not a member yet? Register   Sign In
difficulty with $this->db->select_max function
#1

[eluser]bill19[/eluser]
Hi everyone,

I am having trouble with the $this->db->select_max

Here is my DB:

CREATE TABLE `zipcodes` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`zip` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`state` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`ap` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Here is my code:

Code:
$this->db->select_max('ap');
$query = $this->db->get('zipcodes');


        echo "SELECT MAX ".$query;
        var_dump($query);
        
        exit;

Here is the output:

Quote:Severity: 4096

Message: Object of class CI_DB_mysql_result could not be converted to string

Filename: models/zipCodeData.php

Line Number: 93


SELECT MAX

object(CI_DB_mysql_result)[41]
public 'conn_id' => resource(27, mysql link persistent)
public 'result_id' => resource(43, mysql result)
public 'result_array' =>
array
empty
public 'result_object' =>
array
empty
public 'custom_result_object' =>
array
empty
public 'current_row' => int 0
public 'num_rows' => int 1
public 'row_data' => null

Can anyone see why this doesn't work?

Thanks in advance,

KC


Messages In This Thread
difficulty with $this->db->select_max function - by El Forum - 11-08-2011, 08:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB