Hello everyone.
I moved my database from the a site to a new one. Now I have one error when I am trying to connect with my database.
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
Can you help me to make a new one please? A conversión?
For me is very complicated. I am little by little learning things but still need a lot of help. I looked for info in our forum but I couldn't find anything.
Thank you very much indeed!
I moved my database from the a site to a new one. Now I have one error when I am trying to connect with my database.
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
Can you help me to make a new one please? A conversión?
For me is very complicated. I am little by little learning things but still need a lot of help. I looked for info in our forum but I couldn't find anything.
Thank you very much indeed!
PHP:
<?
$databasehost = "host";
$databasename = "db";
$databaseusername = "user";
$databasepassword = "pass";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
$query = file_get_contents("php://input");
$sth = mysql_query($query);
if (mysql_errno()) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
}
?>