Problem with php: expecting ',' or ';' [closed]

1

PHP marks me an error when trying to login, this error marks me:

Parse error: syntax error, unexpected 'private' (T_PRIVATE), expecting ',' or ';' in /opt/lampp/htdocs/webagropac/conexion.php on line 10

This is the code:

<?php

class conexion {
  private $conexion;
  private $server = "localhost";
  private $usuario = "root";
  private $pass = "aassdd";
  private $db = "Agropacdb;"

  private $user; /*Aqui marca el error*/
  private $password; /*Aqui marca el error*/

  public function_construct() {
  $this->conexion = new mysqli($this->server, $this->usuario, $this->pass, $this->db);

  if($this->conexion->connect_errno){

    die("Fallo al tratar de conectar con MySQL: (". $this->conexion->connect_errno.")");

   }

  }

  public function cerrar() {
    $this->conexion->close();
  }

  public function login($usuario, $pass) {

    $this->user = $usuario;
    $this->password = $pass;

    $query = "SELECT id_u, nombre_u, apellido_u, alt_u, pass_u From Usuarios WHERE alt_u = '".$this->user."' and pass_u = '".$this->password."' ";

    $consulta = $this->conexion->query($query);

    if($row = mysqli_fetch_array($consulta)){

        session_start();

        $_session['id'] = [$id_u];
        $_session['nom'] = [$nombre_u];
        $_session['ape'] = [$apellido_u];

        echo "Has iniciado sesion";

        echo $_session['id'];
        echo $_session['nom'];
        echo $_session['ape'];

    } else {

      echo "Usuario o contrasena incorrectos";
    }
  }

}

 ?>

Line 10 is:

private $db = "Agropacdb;"
    
asked by Guillermo Navarro 17.09.2016 в 04:21
source

1 answer

4

This line:

private $db = "Agropacdb;"
                       ^^^^

It should be:

private $db = "Agropacdb";

As you will see, you included the ; within the quotes, so you take it as part of the text, and do not separate instructions.

    
answered by 17.09.2016 / 05:18
source