Here is my connection and process code. It works in localhost computer.But when hosted,insertion is not happening. WHY ??
<?php
$servername='localhost';
$username='Admin';
$password="root";
$dbname='dbname';
//CREATE CONNECTION
$conn=mysqli_connect($servername,$username,$password); //,$dbname);
//CHECK SERVER CONENCTION
if(mysqli_connect_errno($conn))
{
echo"<script>";
echo"alert('Connection Failed'.$conn->connect_error)";
echo"</script>";
}
else
{ //CHECK DATABASE CONNECTION
if(!mysqli_select_db($conn,$dbname))
{
echo"<script>alert('Database not selected'); </script>".die(mysqli_error($conn));
}
}
?>
process.php
<?php
$sqli="INSERT INTO tbl_user(u_fname,u_lname,u_address,u_phone1,u_phone2,u_dob,u_gender,u_usertype,u_created_at) VALUES (?,?,?,?,?,?,?,?,?);";
$stmt=mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sqli)){
header("location:/signup.php?err=sqlError002-ut1-u");
exit();
} else { echo "this is showing";
mysqli_stmt_bind_param($stmt,"sssiissis",$fname,$lname,$address,$phone1,$phone2,$dob,$gender,$usertype,$created_at);
if(mysqli_stmt_execute($stmt)){ echo "this one is not showing";
$uid= mysqli_insert_id($conn);
}
}
?>