SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: class problem

  1. #1
    SitePoint Zealot sifuhall's Avatar
    Join Date
    Jun 2001
    out of the sidehatch
    0 Post(s)
    0 Thread(s)

    class problem

    I'm stumped by this, any help is apreciated.

    I have two files, kwoon.php (contains kwoon class), and signup.php (uses kwoon class).

    Here is my error message:

    Fatal error: Call to a member function on a non-object in /home/virtual/dragonslist/home/httpd/html/fun/game/signup.php on line 120
    Here is the snippet of signup.php:
    // get kwoon info
    include_once ("kwoon.php");
    $newKwoon = new kwoon();
    $retval = $newKwoon->kwoonVerify($kwoonname, $password, $activation);
    // test for retval
    if (strlen($retval) > 1) {
    $myoutput = new output();
    // display error page
    Note: The error mentioned above (line 120) is the last line here ($newKwoon->kwoonActivate())

    And finally here is a snippet of kwoon.php (right before the program fails:
    // get kwoon info by kwoon name
    function kwoonByName() {

    // database connection info
    require ("dlgame.php");

    // check for persistant database connection
    mysql_pconnect("localhost", $dbuser, $dbpass);

    $query = "SELECT * from players where kwoon='$inputKwoonName'";
    $result = mysql_db_query($dbname, $query);
    $kwoon = mysql_fetch_assoc ($result);
    $this = $kwoon;

    How can the var $newKwoon be OK on line 119, execute kwoonByName, and then be a non-object on line 120?

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Channel Islands Girth: Footlong
    0 Post(s)
    0 Thread(s)
    Confusing code, all those kwoons! I can't say I know exactly where the problem is but here are my suggestions:

    1) There may be a problem in dlgame.php which you are specifying as a require.

    2)It was hard to read but are you sure you have the references to all the various operators, functions etc - are there any "kwoons" where you have inadvertently capitalised the wrong letter - so apache spits it back saying it doesn't exist?

    3) In kwoon.php you have said:

    $query = "SELECT * from players where kwoon='$inputKwoonName'";
    ?That should be $query=mysql_query("SELECT * from players where kwoon='$inputKwoonName'");

    Any help?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts