Thread: PHP Classes

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Rochester, NY, United States
    Posts
    9
    Rep Power
    0
    I made a wrapper class for MySQL ....

    class MySQL {
    var $ptrResult;

    function Query($Query) {
    $this->ptrResult = MYSQL_QUERY($Query);
    }

    function Result($Index, $Field) {
    return MYSQL_RESULT($this->ptrResult, $Index, $Field)
    }
    }

    for some reason no matter what I do $this->ptrResult is always 0 is there a flaw in my class or what? I verified my $Query value and it gives back the correct information it's just that when I try this it won't work

    .. there are other functions in the class but those are the one's that don't work.... er the result pointer never gets set for some reason....

    ------------------
    Q: What kind of person is worth becoming?
    A: The person you are now.
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    I see nothing wrong with your class definition. What do you mean you verified your query? Did you send it to mysql via the command line?

    If you get a 0 result that means that MySQL is throwing an error. You should add logic that tests ptrResult and if false print mysql_error(); to see what that error is.

    This can be done in the Query() method or in the main script, whichever best suits your purpose for error control.

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 10:45 PM
  2. How to see the Memory used by a PHP script?
    By Pardall in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 03:54 PM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM
  4. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 03:12 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo