-2
I am creating a client registration system and when I run . php it simply appears this error:
php code:
<?php
$login = $_POST['inputEmail'];
$senha = MD5($_POST['inputSenha']);
$connect = mysql_connect('localhost','postgres','root');
$db = mysql_select_db('SrVisao');
$query_select = "SELECT inputEmail FROM usuarios WHERE inputEmail = '$inputEmail'";
$select = mysql_query($query_select,$connect);
$array = mysql_fetch_array($select);
$logarray = $array['inputEmail'];
if($inputEmail == "" || $inputEmail == null){
echo"<script language='javascript' type='text/javascript'>
alert('O campo email deve ser preenchido');window.location.href='
cadastroCliente3.html';</script>";
}else{
if($logarray == $inputEmail){
echo"<script language='javascript' type='text/javascript'>
alert('Esse login já existe');window.location.href='
cadastroCliente3.html';</script>";
die();
}else{
$query = "INSERT INTO usuarios (inputEmail,inputSenha) VALUES ('$inputEmail','$inputSenha')";
$insert = mysql_query($query,$connect);
if($insert){
echo"<script language='javascript' type='text/javascript'>
alert('Usuário cadastrado com sucesso!');window.location.
href='login.html'</script>";
}else{
echo"<script language='javascript' type='text/javascript'>
alert('Não foi possível cadastrar esse usuário');window.location
.href='cadastroCliente3.html'</script>";
}
}
}
?>
I think you should use mysqli_connect() instead of mysql_connect() see the difference: https://answall.com/questions/63331/dif%C3%A7a-entre-as-fun%C3%A7%C3%B5es-mysql-connect-e-mysqli-connect-em-php
– Valdir Giorgi