Welcome Guest, Not a member yet? Register   Sign In
PostgreSQL and Query Builder problem
#1
Big Grin 

Hey guys, it's me again Big Grin 

In my work, they want to develop an app with CI4, to educational proposals, but, when they want to work with the Builder and PostgreSQL, they return this

PHP Code:
object(CodeIgniter\Database\Postgre\Result)#69 (8) { ["connID"]=> resource(13) of type (pgsql link) ["resultID"]=> resource(15) of type (pgsql result) ["resultArray"]=> array(0) { } ["resultObject"]=> array(0) { } ["customResultObject"]=> array(0) { } ["currentRow"]=> int(0) ["numRows"]=> NULL ["rowData"]=> NULL } 

i made a little projects with MySQL and they works excellent, but with PostgreSQL, it's a headache.


The controller:

PHP Code:
namespace App\Controllers;
use 
App\Models\Usuarios_model;
use 
CodeIgniter\API\ResponseTrait;

class 
Usuarios extends BaseController{{
public function 
autenticar(){
        $model = new Usuarios_model();
        $userdata = array();
        //var_dump($this->request->isAJAX());
        //die();
        if($this->request->isAJAX()){
            $datos json_decode(base64_decode($this->request->getPost('data')),TRUE);
            $query $model->getUser($datos["user"], $datos["pass"]);
            var_dump($query);
            die();
            if(!isset($query)){
                foreach($query->getResult() as $row){
                    $userdata["usuario"] = $row->usernick;
                    $userdata["usuarioid"] = $row->id_user;
                    $userdata["logged"] = TRUE;
                }

                $this->session->set($userdata);
                return $this->respond(["message" => "bienvenido"],200);
            }
            else{
                return $this->respond(array('message' => 'Usuario o contraseña incorrectos'),404);
            }
        }
        else{
            return redirect()->to('/403');
        }
    }

In the previous version, the Framework works excelent with PostgreSQL, with pg_connect(), but now, i can't get how many rows can affected and how many rows the query retrived, but, i can do all that stuffs with MySQL.
Reply
#2

i also have same problem.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB