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
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.