Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

closed as not a real question by Zoredache, Warner, John Gardeniers, Sam, Zypher Jun 17 '10 at 20:16

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
... You can tell us what error you're getting... –  Ignacio Vazquez-Abrams Jun 14 '10 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 '10 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 '10 at 23:57
    
@Zoredache: mysql_error doesn't display anything. –  lowerkey Jun 15 '10 at 8:09
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
1  
Not necessarily. Let's see what the specific error is first. –  Ignacio Vazquez-Abrams Jun 15 '10 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 '10 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 '10 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 '10 at 9:10
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.