Connection Problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prenuka84
    New Member
    • Oct 2006
    • 1

    Connection Problems

    I have windows 2000 server with sp4
    I m using php 5.*
    mysql 5.*
    & IIS

    I am not able to connect the MySQL using function mysql_connect or mysqli_connect( )

    It is giving error that is
    Parst error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' ub C:\program files\Apachegro up\...\on line 5

    I have also edited php.ini & uncomment the php_mysql.dll

    but it is giving erroe as PHP startup: unable to load dynamic library './php_mysql.dll'- the specified module could not be found

    my php code is
    [php]
    <?php
    $username = "myuser";
    $password = "mypass";
    $hostname = "localhost" ;
    $dbh = mysql_connect($ localhost, $myuser, $mypass)
    or die("Unable to connect to MySQL");
    print "Connected to MySQL<br>";
    // you're going to do lots more here soon
    mysql_close($db h);
    ?>[/php]

    what should I do?
    Any one can help me plz? :(
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Should it not be better to do this:
    [php]
    $username = "myuser";
    $password = "mypass";
    $hostname = "localhost" ;
    $dbh = mysql_connect($ hostname, $username, $password)
    [/php]
    Ronald :cool:

    Comment

    • Nert
      New Member
      • Nov 2006
      • 64

      #3
      Originally posted by prenuka84
      I am not able to connect the MySQL using function mysql_connect or mysqli_connect( )

      It is giving error that is
      Parst error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' ub C:\program files\Apachegro up\...\on line 5

      I have also edited php.ini & uncomment the php_mysql.dll

      but it is giving erroe as PHP startup: unable to load dynamic library './php_mysql.dll'- the specified module could not be found

      my php code is
      [php]
      <?php
      $username = "myuser";
      $password = "mypass";
      $hostname = "localhost" ;
      $dbh = mysql_connect($ localhost, $myuser, $mypass)
      or die("Unable to connect to MySQL");
      print "Connected to MySQL<br>";
      // you're going to do lots more here soon
      mysql_close($db h);
      ?>[/php]

      what should I do?
      Any one can help me plz? :(
      hi,

      if you have uncommented the php_mysql.dll you should have the libmysql.dll and php_mysql.dll on your php root folder.

      and try to use code something like this.

      <?
      mysql_connect(' hostname', 'username', 'password') or die('error : '.mysql_error);
      echo 'Successfully connected to MySql Server';
      ?>
      although it's the same as your coding but i just preffer using something like that code hehehe..

      bye -- bye

      -- nert

      Comment

      Working...