Connecting to PHP
I'm trying to get a simple connetion to mysql database using php running on localhost using an apache server but can't seem to get connected..i have all th necessary .dll files included in the php.ini file but i still can't connect nor is there a section in the phpinfo().php file like the section indicating that apache is set up, but there are a few references mentioned to the mysql directory. Is there something else i need to set up.
've 2 different examples of trying to connect
PHP Code:
<?php
$mysqli = new mysqli("localhost","root","Munster123");
if (mysqli_connect_errno())
{
printf("Connect Failed: %s\n", mysqli_connect_error());
exit();
}else{
printf("Host Information: %sn", mysqli_get_host_info($mysqli));
}
?>
returns an error
Fatal error: Class 'mysqli' not found in C:\Apache2\htdocs\testing.php on line 2
AND
PHP Code:
<?php
$link = mysql_connect('localhost', 'root', 'Munster123');
if (!$link) {echo 'Connected successfully';
}
else{
die('Could not connect: ' . mysql_error());}
mysql_close($link);
?>
returns an error
Fatal error: Call to undefined function mysql_connect() in C:\Apache2\htdocs\testing2.php on line 2
|