Hi ,

        It z amazing behaviour...I am wondering how it is coming only for first time execution.
      If I remove the two If conditions in authentication.php and if I execute then it is displaying the blank screen. And again if we replace those two if conditions and if you execute again then it works fine.
Details are below: 

        I have a login page where we enter login details..And I post these details to authentication.php

        After system rebooting if I execute first time it is giving alert with message

        Program Error

                "php.exe has generated errors and will be closed by windows.
                  You will need to restart the program. An error log is being created.
                        OK             "

        post emp_id and password to authentication.php


        // Connect to MySQL
        $connection=mysql_connect( 'localhost', 'balaji', 'pingpong' ) or die ( 'Unable to connect to server.' );
        // Select database on MySQL server
        mysql_select_db( 'amerm' ) or die ( 'Unable to select database.' );
        // Formulate the query
        $sql = "SELECT * FROM employee WHERE emp_id = '$emp_id' AND  emp_pass = PASSWORD('$emp_pass')";
        // Execute the query and put results in $result
        $result = mysql_query( $sql )   or die ( 'Unable to execute query.' );
        // Get number of rows in $result.
        $num = mysql_numrows( $result );
        if ( $num != 0 )
                $row = mysql_fetch_object($result);
                // A matching row was found - the user is authenticated.
                //start a new session by registering the employee number.
                $pw  =$emp_pass;

//This is the precious code. If we remove these two conditions and if you run once. Then it shows blank.
                //And if you run second time withese two conditions it works fine
                if ($row->user_type=='S')

                        //close mysql connection
                        header("Location: admin.php");
                else if ($row->user_type=='U')
                        //close mysql connection
                        header ("Location: user.php");
                //close mysql connection
                //User does not exist or not authenticated.
How can I overcome this problem.
Thanks in advance.

Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to