php error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mubs
    New Member
    • Mar 2007
    • 77

    php error

    Hi ppl..


    i have a website setup and a database running with it, everything works fine on my desktop pc and now i am trying to get it working on my laptop..

    but i get the following error when running the website

    could any1 plz suggest something

    error:Warning: mysql_pconnect( ) expects parameter 4 to be long, string given in C:\xampp\htdocs \checklogin.php on line 9

    Fatal error: in C:\xampp\htdocs \checklogin.php on line 9


    many thanks
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Post the code giving the error so we can help.

    Comment

    • Mubs
      New Member
      • Mar 2007
      • 77

      #3
      [PHP]<?

      $hostname_mysql _connect = "localhost" ;
      $database_mysql _connect = "website_member s";
      $username_mysql _connect = "root";
      $password_mysql _connect = "******";
      $tblname_mysql_ connect ="members";

      $mysql_connect = mysql_pconnect( $hostname_mysql _connect, $username_mysql _connect, $password_mysql _connect, $tblname_mysql_ connect) or trigger_error(m ysql_error(),E_ USER_ERROR);
      mysql_select_db ($database_mysq l_connect) or die(mysql_error ());

      $myusername = $_POST['myusername'];
      $mypassword = $_POST['mypassword'];

      $sql = "SELECT * FROM $tblname_mysql_ connect WHERE username= '$myusername' and passwords='$myp assword'";
      $result = mysql_query($sq l) or die(mysql_error ());

      $count = mysql_num_rows( $result);

      if($count==1) {
      session_registe r("myusername") ;
      session_registe r("mypassword") ;
      header("locatio n: login_success_w elcome.php");
      }
      else {
      echo "Wrong Username or Password";
      }

      ?>[/PHP]

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        mysql_pconnect' s 4th parameter [quote from php.net]

        The client_flags parameter can be a combination of the following constants: 128 (enable LOAD DATA LOCAL handling), MYSQL_CLIENT_SS L, MYSQL_CLIENT_CO MPRESS, MYSQL_CLIENT_IG NORE_SPACE or MYSQL_CLIENT_IN TERACTIVE.
        It doesn't take a table name as the parameter.

        Comment

        • Mubs
          New Member
          • Mar 2007
          • 77

          #5
          so hw cud i reslove this...

          Comment

          • Mubs
            New Member
            • Mar 2007
            • 77

            #6
            got it working


            thanks 4 da help

            Comment

            • Atli
              Recognized Expert Expert
              • Nov 2006
              • 5062

              #7
              Hi.

              Might I point out that this:
              [code=php]
              $myusername = $_POST['myusername'];
              $mypassword = $_POST['mypassword'];

              $sql = "SELECT * FROM $tblname_mysql_ connect WHERE username= '$myusername' and passwords='$myp assword'";
              [/code]
              is a very very bad piece of code.

              This makes you vulnerable to SQL injection, which is not a good thing to be.
              Check out SQL Injection in the PHP manual to see why.

              Comment

              • pbmods
                Recognized Expert Expert
                • Apr 2007
                • 5821

                #8
                Heya, Mubs.

                Glad you were able to get it working! How did you end up solving it?

                Comment

                Working...