Insert custom mysql with viewer_functions

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 17, 2023   (RSS)

By AlanAlonso - March 16, 2023

Is there a shortcut using viewer_functions to insert custom mysql to the cmsb database, to avoid using this?

$conexion = mysqli_connect("localhost","user","pass","database");
if(!$conexion){
	die('No se puede conectar '.mysql_error());
	}
if (mysqli_query($conexion, $output )) {
    header("Location: alumnos.php");
die();
} else {
    echo mysqli_error($conexion);
}
mysqli_close ($conexion);

By AlanAlonso - March 17, 2023

Thank you Dave

The mysqli object working like a charm y will check mysql_escape() function.

ob_start();
include 'calificaciones_save_post.php';
$output = ob_get_clean();
if (mysqli()->query($output)) {
    header("Location: alumnos.php");
die();
} else {
    dieAsCaller("MySQL Error: ". htmlencode(mysqli()->error) . "\n");
}