PHP sql connect not working

epiz_30157065

The error is output facing here

whereas working in other PHP processors
according to this code

My code used for PHP

// database connection code

// $con = mysqli_connect('fdb31.biz.ht', '3911959_myd', 'Nithin@123','3911959_myd');

$con = mysqli_connect('fdb31.biz.ht', '3911959_myd', 'Nithin@123','3911959_myd');

// get the post records

$name = $_POST['name'];

$email = $_POST['email'];

$sub = $_POST['sub'];

$message = $_POST['message'];

echo "<p style=color:#333>Hello ".$name." !<br><p>";

// database insert SQL code

$sql = "INSERT INTO `tbl_message` (`Id`, `Name`, `EMail`, `Subject`, `Message`) VALUES ('0', '$name', '$email', '$sub','$message')";

// insert in database

$rs = mysqli_query($con, $sql);

if($rs)

{

echo "<p style=color:green>Thank You !<br>Your Message Recieved<br><p>";

}

else

{

echo "<p style=color:red>Sorry !<br>There is an Error in submitting your message<p><br>";

}
1 Like

@simhaatsimha, you have shared your database password, which means anyone can log into your database and alter anything he/she wishes. Please change your password and remove it from your post.


I believe you cannot connect to external databases here. You can follow these guides (in order):

EDIT: Are you hosting on InfinityFree? because biz.ht is another hosting service.

2 Likes

This is totally incorrect. Please use the data from the control panel and the client area. Also, change your password, as you just publicly exposed it.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.