0

I'm new to PHP, MySQL dev. I'm trying to make a simple webapp, was following a tutorial. This is the PHP script it showed to grab info about the 'detectives' table.

<?php
$mysqli = new mysqli('localhost', 'root', 'root!', 'intrepid_detectives');
$result = $mysqli->query("SELECT * FROM detectives");

echo "<pre>";
print_r($result);

But when I open this page on my browser by going to localhost/index.php, it gives me this error:

The website encountered an error while retrieving http://localhost/index.php. It may be down for maintenance or configured incorrectly.

I asked a guy, he said the problem is with mysqli, so I searched on SO, and followed this post, but it still gives the same error.

Community
  • 1
  • 1
a_rahmanshah
  • 1,636
  • 2
  • 22
  • 35

1 Answers1

1

Things to try :

  • can you open a simple html file in the same directory, index.html for example ?
  • did you try showing the errors on page with ini_set('display_errors', 1); error_reporting(E_ALL); ? Or is there something in the error.log ?
  • do you have a .htaccess or vhost configuration that could interfere with what you want?

Checking these will certainly point you to the right direction I hope :)

fab4am
  • 56
  • 2
  • Yep, I have other HTML pages in that directory which works fine. And I tried running some simple PHP scripts (echo "Hello World") which also work fine. – a_rahmanshah Mar 28 '13 at 07:19
  • I tried following this question again http://stackoverflow.com/questions/10769148/extension-mysqli-is-missing-phpmyadmin-doesnt-work And it works now. Thanks a lot for your help! :D – a_rahmanshah Mar 28 '13 at 07:31