___ erk reglamentos ___ Who gives me this error? Parse error: syntax error, unexpected '' ______ qstntxt ___

I have my php class:

%pre%

this class is where I get the data from the DB, to fill a drop-down list, this class communicates with another class that I use as a controller:

%pre%

The problem is that when I run the page where my form sends me this error php: Parse error: syntax error, unexpected '' (T_STRING), expect function (T_FUNCTION) or const (T_CONST) in C: \ wamp64 \ www \ webprueba \ php \ modelo.php on line 2 What I understand is that you expect a parameter but I'm not sure, if you could guide me in this matter, thank you.

    
______ azszpr221711 ___

I've been able to solve it, thanks people. Well my solution was that the compiler detected blank spaces after each line of code, I do not know why but I went line by line eliminating all blank space and so it was correcting, as I was told here there was no greater "visible" error in the code but I have the doubt of why I detected as error the spaces between lines, do you know why?.

    
___

1

I have my php class:

    <?php
    class Service {    
    private $servicio;
    private $db;
    private $procesos;

    public function __construct() {
        //$this->servicio = array();
        $this->procesos = array();
        $this->$db = new mysqli("localhost", "root", "", "prospera");
    }


    private function setNames() {
        return $this->db->query("SET nombre 'utf8'");
    }

    public function getServicios() {

        self::setNames();
        $sql = "SELECT id, nombre, precio FROM tbproducto";
        foreach ($this->db->query($sql) as $res) {
            $this->servicio[] = $res;
        }
        return $this->servicio;
        $this->db = null;
    }

    public function setServicio($nombre, $precio) {

        self::setNames();
        $sql = "INSERT INTO tbproducto(nombre, precio) VALUES ('" . $nombre . "', '" . $precio . "')";
        $result = $this->db->query($sql);

        if ($result) {
            return true;
        } else {
            return false;
        }
    }

    public function getListaProcesos(){
        $sql = "SELECT DISTINCT proceso2 FROM tbuniverso WHERE proceso2 LIKE '%B2_18'";
        foreach ($this->db->query($sql) as $res ) {
            $this->procesos[] = $res;

        }
        return $this->procesos;
        $this->db = null;
    }

}
?>

this class is where I get the data from the DB, to fill a drop-down list, this class communicates with another class that I use as a controller:

    <?php   
    require ("modelo.php");
    require_once ("../index.php");
    $services = new Service();
    $datos = $services->getListaProcesos();
    ?>

The problem is that when I run the page where my form sends me this error php: Parse error: syntax error, unexpected '' (T_STRING), expect function (T_FUNCTION) or const (T_CONST) in C: \ wamp64 \ www \ webprueba \ php \ modelo.php on line 2 What I understand is that you expect a parameter but I'm not sure, if you could guide me in this matter, thank you.

    
asked by EdgarOsf 12.12.2018 в 20:43
source

1 answer

-1

I've been able to solve it, thanks people. Well my solution was that the compiler detected blank spaces after each line of code, I do not know why but I went line by line eliminating all blank space and so it was correcting, as I was told here there was no greater "visible" error in the code but I have the doubt of why I detected as error the spaces between lines, do you know why?.

    
answered by 12.12.2018 в 21:29