<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$aa = (isset($_POST['aa'])) ? $_POST['aa'] : false;
$a= (isset($_POST['a'])) ? $_POST['a'] : false;
$b = (isset($_POST['b'])) ? $_POST['b'] : false;
$c = (isset($_POST['c'])) ? $_POST['c'] : false;
$d = (isset($_POST['d'])) ? $_POST['d'] : false;
$e = (isset($_POST['e'])) ? $_POST['e'] : false;
$f = (isset($_POST['f'])) ? $_POST['f'] : false;
$g = (isset($_POST['g'])) ? $_POST['g'] : false;
if ($aa && $c) {
$query = "INSERT INTO casa
VALUES ('$aa', '$a', '$b', '$c', '$d', '$e', '$f', '$g', 1);";
$conexion = mysqli_connect('localhost','hostname','password','data_base');
$resultado = mysqli_query($conexion, $query);
if ($resultado) {
echo 'OK';
} else if (mysqli_errno($conexion) == 1062) {
echo 'Duplicado';
} else {
echo 'Error';
}
} else {
//header("Location: index.html");
echo 'asad';
}
When I upload all my filles to a web hosting, I compliment all the form and when I send it:
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /home/vol4_2/260mb.net/n260m_21275877/xxxx.260mb.org/htdocs/form.php on line 26 Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/vol4_2/260mb.net/n260m_21275877/xxxx.260mb.org/htdocs/form.php on line 30 Error
And line 26 is the connection and line 30 is the mysqli_query
I need some help. thanks!!
FALSE
as the first parameter tomysqli_query
. Check if the parameters tomysqli_connect
are correct.mysqli_connect_error()
and see what is the error.. It is unable to connect. php.net/manual/en/function.mysqli-connect.php