I am developing an app with, Php 7.2, javascript, html5 and css3 ... the app in the local server (LAMP) inserts the record (create a user) to the database but in the server that was acquired it does not executing the same query. I tried a test hosting that I have and correctly execute the query. The specifications of my local server:
Apache/2.4.33 (Unix) OpenSSL/1.0.2o PHP/7.2.5 mod_perl/2.0.8-dev
Perl/v5.16.3
Versión del cliente de base de datos: libmysql - mysqlnd 5.0.12-dev -
20150407 -
$Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
extensión PHP: mysqliDocumentación curlDocumentación
mbstring Documentación
Versión de PHP: 7.2.5
The characteristics of the test server that correctly executes the query:
cPanel Versión 70.0 (build 54)
Versión Apache 2.2.34
Versión PHP 5.4.45
Versión MySQL 5.6.39-83.1
Characteristics of the server that presents the problem with data entry:
cPanel Versión 74.0 (build 1)
Versión Apache 2.4.34
Versión PHP 5.6.36
Versión MySQL 10.2.16-MariaDB
To create a user the system makes a directory with the user name and photo (with PHP), in the file manager of the Cpanel the folder is created, with the username and the photo inside but in the database not the record is entered.
the Class with which I connect in the hosting is with your db and user indicated.
class Conexion{
static public function conectar(){
$link = new PDO("mysql:host=localhost;dbname=pos",
"root",
"");
$link->exec("set names utf8");
return $link;
}
}
The function that the user enters in the model:
static public function mdlIngresarUsuario($tabla, $datos){
$stmt = Conexion::conectar()->prepare("INSERT INTO $tabla(nombre, usuario, password, perfil, foto) VALUES (:nombre, :usuario, :password, :perfil, :foto)");
$stmt->bindParam(":nombre", $datos["nombre"], PDO::PARAM_STR);
$stmt->bindParam(":usuario", $datos["usuario"], PDO::PARAM_STR);
$stmt->bindParam(":password", $datos["password"], PDO::PARAM_STR);
$stmt->bindParam(":perfil", $datos["perfil"], PDO::PARAM_STR);
$stmt->bindParam(":foto", $datos["foto"], PDO::PARAM_STR);
if($stmt->execute()){
return "ok";
}else{
return "error";
}
$stmt->close();
$stmt = null;
}