I am look at an old PHP project that uses mysql_connect, and I am trying to update it to PHP 7, by using mysqli_connect.
In the original project, I had a file - connect.php which had the database info, I would then include that file where needed. But I cant seem to get this to work in PHP7
Original file looked like this.
// Connects to my Database
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error());
I have changed to this
$con=mysqli_connect("your.hostaddress.com", "username", "password","Database_Name");
now on a page where I had
and am now trying to use
return mysqli_real_escape_string($con, $data);
and I get the error con is not defined.
How can i keep the original structure but update to PHP7