Jump to content

Mysql/php problems.


Lukey

Recommended Posts

Hi i hope this is the right forum.

 

I am attempting a simple database connection using php

 

i have installed apache php and mysql.

Created a mysql database with a table etc.

 

I can get phpinfo(); to show on my apache server however..

 

I am trying this simple script to test a connection to the data base but i get no result, no error message nothing.

 

<?php

 

$mysqli = new mysqli("localhost", "root", "****", "sunhouse"); // Creates connection to sunhouse database

 

if(mysqli_connect_errno())

{

printf("Connection Failed: %s\n", mysqli_connect_error());//error message

exit();

}

else

{

printf("Host Info: %s\n", mysqli_get_host_info($mysqli));

mysqli_close($mysqli);

}

 

?>

 

I have edited the php.ini file to include the mysqli extension by removing the semicolon at:

extension=php_msql.dll and

extension=php_mysqli.dll

 

Also i have selected the correct extension directory as in the FAQ.

 

Any help would be appreciated as without even an error message i am struggling!

 

Link to comment
https://forums.phpfreaks.com/topic/51680-mysqlphp-problems/
Share on other sites

Actually i checked the phpinfo page using the find function in Firefox and there is no mention of mysqli

 

:(

 

I am running locally, i tried using XAMPP but had issues with it so i am using a package on a cd from a book.

 

Its all installed and running as i can access phpinfo(); from http://localhost/phpinfo.php

Is mysql listed where in the phpinfo?

 

It says....

 

MSQL Support enabled

Allow Persistent Links yes

Persistent Links 0/unlimited

Total Links 0/unlimited

 

but no mysql

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">

<!-- Created on 13-May-2007 18:35:18 -->

<html>
   <head>
      <title>
         Please login here
      </title>
      <meta name="GENERATOR" content="Arachnophilia 5.3"/>
      <meta name="FORMATTER" content="Arachnophilia 5.3"/>
       
   </head>

   <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#ff0066" alink="#ff0000">
HELP ME
<br/>

<h1>
<?php

$mysqli = new mysqli("localhost", "root", "blahblah", "sunhouse"); // Creates connection to sunhouse database

if(mysqli_connect_errno())
{
printf("Connection Failed: %s\n", mysqli_connect_error());//error message
exit();
}
else
{
printf("Host Info: %s\n", mysqli_get_host_info($mysqli));
mysqli_close($mysqli);
}
?>
</h1>
   </body>
</html>
|

 

Here is the entire script. It displays HELP ME then blank no notification whether its connected and no error message

Nope doesnt work.

 

I have done this:

 

http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath

 

Do you think i need to do the next step below it aswell?

 

53.15. How do I make the php.ini file available to PHP on windows?

Ok, so now we have errors. I have had this problem before. The thing is that there is a really long and complicated string of things to do. Just one quick question. Where is the php.ini file that you have been editing, and was it php.ini-recommended, or php.ini-dist?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.