--- In [email protected], "balthork" <[EMAIL PROTECTED]> wrote:
> --- In [email protected], "Mike Franks" <[EMAIL PROTECTED]> wrote:
> > 
> > On 7/13/2005, "balthork" <[EMAIL PROTECTED]> wrote:
> > 
> > >
> > >
> > >
> > I having some problems with the following code:
> > 
> > [ BEGIN CODE SNIPPET ]
> > <?
> > session_start();
> > 
> > if(!isset($_SESSION["iMemberID"])){
> >       $_SESSION["iMemberID"] = 19;
> > }
> > require_once("../classes/class.mysql.php");
> > require_once("../_global.php");
> > require_once("../classes/class.members.php");
> > require_once("../classes/class.mail.php");
> > >
> > >
> > >
> > 
> > Balthork - I don't have much time right now, so haven't looked at your
> > code thoroughly. One thing you should change for sure - move your
> > require_once() statements for the class definitions BEFORE your
> > session_start() statement.
> > 
> > If you ever hope to retrieve an instance of an object from
session, the
> > definition for that objects' class must be parsed BEFORE
> > session_start().
> > 
> > Leave the require_once("../_global.php"); stmt AFTER session_start(),
> > because it relies on session variables.
> > 
> > That may solve your problem, so please let us know either way.
> > 
> > Mike
> 
> That made some progress, however, I'm not getting the following error:
> 
> Error performing query SELECT * FROM tblMembers WHERE iMemberID = 19
> 
> Thank you Mike for all of the help you have been offering!!

Let me follow this up with the code from class.mysql.php

<?
class MySQLConnector {
    var $conId; // connection identifier
    var $host; // MySQL host
    var $user; // MySQL username
    var $password; // MySQL password
    var $database; // MySQL database
    var $result; // result set
    // constructor
    function MySQLConnector($host,$user,$password,$database){
        // validate incoming parameters
        (!empty($host))?$this->host=$host:die('Host parameter not valid');
        (!empty($user))?$this->user=$user:die('User parameter not valid');
        (!empty($password))?$this->password=$password:die('Password
parameter not valid');
        (!empty($database))?$this->database=$database:die('Database
parameter not valid');
        // connect to MySQL and select database
        $this->connectDB();
    }
    // connect to MYSQL server and select database
    function connectDB(){
       
$this->[EMAIL PROTECTED]($this->host,$this->user,$this->password)
or die('Error connecting to the server '.mysql_error());
        @mysql_select_db($this->database,$this->conId) or die('Error
selecting database');
    }
    // perform query
    function performQuery($query){
        $this->[EMAIL PROTECTED]($query,$this->conId) or die('Error
performing query '.$query);
    }
    // fetch row
    function fetchRow(){
        return mysql_fetch_array($this->result,MYSQL_ASSOC);
    }
    // get number of rows
    function getNumRows(){
        return mysql_num_rows($this->result);
    }
    // get number of affected rows
    function getAffectedRows(){
        return mysql_affected_rows($this->conId);
    }
    // get ID from last inserted row
    function getInsertID(){
        return mysql_insert_id($this->conId);
    }
}
?>




Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to