Jump to content

jjjcr

New Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by jjjcr

  1. hi guys, i'm stuck need your brilliant ideas.

     

    just trying to get my hands wet on php and mysql.

     

    had this code below, but i'm not getting anything. there's no error displayed, no successful connection message.

     

    but using command prompt, i'm able to connect to mysql but using php code cannot.

     

    any ideas why there is no message displayed using this code below, if i run the code it's just a blank page.

     

    please help, thanks in advance.

     

    <html>

    <body>

     

     

     

    <?php

     

    // we connect to example.com and port 3307

    $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

     

    if (!$link) {

        die('Could not connect: ' . mysql_error());

    }

    echo 'Connected successfully';

    mysql_close($link);

     

    // we connect to localhost at port 3307

    $link = mysql_connect('127.0.0.1', 'mysql_user', 'mysql_password');

    if (!$link) {

        die('Could not connect: ' . mysql_error());

    }

    echo 'Connected successfully';

    mysql_close($link);

     

     

    ?>

     

     

    </body>

    </html>

     

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