System error after uploading to server

0

The system was developed in php using the codeigniter 3 framework.

It works great on localhost.

I went up to the server and started to get into trouble. I checked the installed php and it is in version 5.6

Errors that happen:

  

Message: Object of class CI_DB_mysqli_result could not be converted to int

     

Filename: models / Users_model.php

     

Line Number: 12

     

Message: Can not modify header information - headers already sent by (output started at /home/user145/public_html/system/system/core/Exceptions.php:271)

     

Filename: helpers / url_helper.php

     

Line Number: 564

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Usuarios_model extends CI_Model {

public function login($username, $password) {
    $this->db->where("username", $username);
    $this->db->where("password", $password);

    $resultados = $this->db->get("usuarios");

    if ($resultados > 0) { ----------------------> LINHA 12
        return $resultados->row();
    }
    else {
        return false;
    }
}}

When I go back to some page this error happens:

  

Severity: Warning

     

Message: unlink (/ tmp / ci_session9c9ddb88511925d48aa2df5fd44857177296879f): Operation not permitted

     

Filename: drivers / Session_files_driver.php

     

Line Number: 384

     

Backtrace:

     

File: &home/user145/public_html/system/application/controllers/Dashboard.php   Line: 7   Function: __construct

     

File: /home/user145/public_html/system/index.php   Line: 315   Function: require_once

After uploading to the server, some pages are not being found when I try to access.

    
asked by anonymous 24.01.2018 / 19:36

1 answer

0

As the comments pointed out above, you may lack some programming experience. On line 12 you are checking if the query returned some data. To do this you do not need to do '$ results > 0 ', since in php everything is considered true, except

  • 0 (zero numeric)
  • "0" (zero string)
  • false
  • "(empty string)
  • null
  • array () (empty array)
  • If you want to study a little more about this I suggest the documentation itself PHP

    So, to make this comparison, just do

    if ($resultados)
    

    Review all your code to see if this is not happening elsewhere.

        
    24.01.2018 / 20:32