0

PHP works, mysql works, but when I call mysql_connect, nothing happens. What can I do?

4
  • 1
    ... You can tell us what error you're getting... Jun 14, 2010 at 23:08
  • I'm not getting an error; I have to scripts, one simple form, index.php and another file, action.php. The action.php file is supposed to open a connection and insert the data from the form into a table.
    – lowerkey
    Jun 14, 2010 at 23:19
  • 3
    Is this something you developed? It almost sounds like it may belong on stackoverflow. Have you examined the output of mysql_error()?
    – Zoredache
    Jun 14, 2010 at 23:57
  • @Zoredache: mysql_error doesn't display anything.
    – lowerkey
    Jun 15, 2010 at 8:09

1 Answer 1

2

I'm guessing you need to enable error reporting in your php.ini file. Or you can set this just within your script by adding these two lines:

 error_reporting(E_ALL);
 ini_set("display_errors", 1);

That way you can see some error messages, and go from there.

4
  • 1
    Not necessarily. Let's see what the specific error is first. Jun 15, 2010 at 1:58
  • I now have a script that reads <?php error_reporting(E_ALL); ini_set("display_errors", 1); $mysqli = new mysqli('localhost', 'root', 'password', 'website'); if(mysqli_connect_errno()){ echo mysqli_connect_error(); exit(); } ?> But still no error message
    – lowerkey
    Jun 15, 2010 at 8:16
  • Scratch that, now, after a long time i get several warnings and one fatal error message: Fatal error: Maximum execution time of 30 seconds exceeded in C:\home\www\index.php on line 5
    – lowerkey
    Jun 15, 2010 at 8:17
  • I reinstalled mysql this time with version 5.5 instead of 5.1. Thanks for the tip with the error reporting!
    – lowerkey
    Jun 15, 2010 at 9:10

Not the answer you're looking for? Browse other questions tagged .