Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Class help

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Class help

    PHP Code:
    class site{
     var 
    $unread;
     var 
    $query;
     var 
    $userid2;
     var 
    $numit;
     var 
    $row;
     var 
    $message;
    function 
    eventmail() {
    $this->unread="unread";
    $this->query=mysql_query("SELECT * FROM `events` WHERE `toid` ='$this->userid2' AND `readornot` ='$this->unread'") or die("Error with event query" mysql_error());

    $this->numit=mysql_num_rows($this->query);
    $this->row=mysql_fetch_array($this->query);
    if(
    $this->numit 0)
    {
    $this->message$this->row['message'];
    if(
    $this->message == "You Have New Mail") {
    echo
    "<br><br><a href='inbox.php'>$message</a>";
    }elseif (
    $this->message == "You Have been Warned!") {
    echo
    "<br><br><a href='yourwarnings.php'>$message</a>";
    }else {
    echo
    "<br><br><a href='inventory.php'>$message</a>"
       }  
    // end of if
       
    // end of if
      
    // end of function
    //end of class 
    For some reason this is not working. I've checked that userid2 is carrying the right ID(10), and i've also checked in the database that there is an event for the ID 10. But for some reason it's not showing up the event message

    EDIT: Oops, i wasn't putting $this->message XD
    Last edited by ole90; 07-26-2007 at 12:04 PM.

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Hi have you tested the connection to the DB.
    Maybe test the query on its own to see if any data is being fetched.
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

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