Fatal error: Call to undefined function mysql_query() - PHP

On my new hosting, when I try to get the data from MySQL database with SELECT statement, the following error notification appears:

Fatal error: Uncaught Error: Call to undefined function mysql_query()

Can you please give me suggestion how can I fix it ? On other hosting I use, the error notification doesn't appear in case of the same source code.

0
give a positive ratinggive a negative rating
Hi,

To execute a query on a MySQL database, try to use function mysqli_query() instead of mysql_query(). The source code for mysqli_query() should look like:

$connection = mysqli_connect("localhost", "username", "password", "database");

if ( $result = mysqli_query($connection, $query) ) {

}
Share on FacebookShare on TwitterShare on LinkedInSend email
1 answer
x
x
2024 AnswerTabsTermsContact us