lundi 6 avril 2015

Call to undefined function error when connecting to mysql using php

I'm just starting to learn how to create dynamic PHP sites and want to figure out how to connect to a MySQL database. I currently have a domain and hosting which runs PHP version 5.4.37 and MySQL 6.5.23. I've looked at different tutorials which all specify the following code to connect to a database:



<?php
$username="myusername";
$password="mypassword";

$database="overeasy_runner";

$link = mysql_connect("mel-s22e",$username,

$password) or die(mysql_error());
echo "connected";
?>


I currently get this error:

Fatal error: Call to undefined function mysql_connect() in /home/overeasy/public_html/testing.php on line 8


I'm not sure if it is because of hostname, username etc settings or something wrong with my code. Thanks in advance!





Aucun commentaire:

Enregistrer un commentaire