mysql_connect() doing nothing at all

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zoltan Dul

    #1

    mysql_connect() doing nothing at all

    Hi there!

    I read here the same named question topic, and a lot of other pages with this name, but I can't find any solution for my problem.

    I have PHP 5.2.14.
    I have Apache 2.2.17
    I have MySQL 5.1.52 (32bit)
    I use Win7 32bit.

    After PHP+Apache installation, I tested php with phpinfo(), it work. Everything looks fine. I write any php code except using MySQL everything is fine.

    I deleted in the php.ini the ; before the mysql.dll-s, and the ext folder is correc, Phpinfo() seems to be good (there is the mysql section); When I use MySQL in command line with pass it's fine. So they (PHP and MySQL) work separated OK but together NOT!

    But when I write this code, doing nothing, I got a really blank page in Chorme, and IE, Firefox offer a downloadable blank php file... without any error messages.

    Code:
    <html>
    <body>
    <?php
    
    error_reporting(E_ALL);
    ini_set('display_errors', 'on');
    
    echo "Working?<br>";
    
    $config['host'] = '127.0.0.1'; //host name
    $config['user'] = 'user'; //database username
    $config['pass'] = 'pass'; //database password
    
    $link = mysql_connect($config['host'],$config['user'],$config['pass']) or die ('Something wrong : ' . mysql_error());
    
    echo "WORK!<br>";
    
    ?>
    </body>
    </html>
    What can I do?

    I didn't found any of solutions. I use 32 bit operation systems and 32 bit MySQL this is not a problem...

    THANKS for Your help!

    Bye,
    Zoli
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    When you run phpinfo() do you see MySQL as a loaded extension?

    Comment

    • Shenno
      New Member
      • Sep 2010
      • 59

      #3
      check hosts file on windows, map 127.0.0.1 to localhost.

      try use "localhost" on your code..

      u can also use echo mysql_error(); before die(); to find out whats wrong.

      Comment

      Working...