Howdy,

 

I am getting a PHP Fatal error (below).  I've tried calling the method with
both $sql->getRow and SQL::getRow.  I checked the SQL, its fine.  Could
someone tell me what I've done wrong??

 

couple errors:

 

[Wed Aug 18 09:59:05 2004] [error] PHP Fatal error:  Call to a member
function on a non-object in /usr/local/apache/htdocs-cna/index.php on line
72

 

[Wed Aug 18 09:59:05 2004] [error] PHP Warning:  Unknown(): Your script
possibly relies on a session side-effect which existed until PHP 4.2.3.
Please be advised that the session extension does not consider global
variables as a source of data, unless register_globals is enabled. You can
disable this functionality and this warning by setting session.bug_compat_42
or session.bug_compat_warn to off, respectively. in Unknown on line 0

 

Code:

            include( $_SERVER['DOCUMENT_ROOT'] . "/include/sql.class.php" );

 

            $sql  = new SQL();

 

$sess->fix_sessions( user_id( $_POST["uid"] ) );

 

            function user_id( $u_name )

            {

72:                    $u_res = SQL::getRow( "SELECT uID FROM tblUser WHERE
uUsername = '$u_name'" );

 

                        return $u_res["uID"];

            }

 

I put a 72 in front of line 72.

 

Here is the relevant class code:

 

 

class SQL

{

                        function getRow( $sql )

                        {

                                    $results = mysql_query( $sql,
DB::connect() );

                                    

                                    if ( $results == false )

                                    {

                                                $this->error =
mysql_error();

                                                

                                                return false;

                                    }

                                    

                                    $rows = mysql_num_rows( $results );

                                    

                                    if ( $rows == 0 )

                                    {

                                                $this->error = "No rows
returned.";

                                                

                                                return false;

                                    }

                                    

                                    $data = mysql_fetch_array( $results );

                                    

                                    return $data;

                        }

}

 

-Dan Joseph

Reply via email to