Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:53:30+00:00 2026-06-09T12:53:30+00:00

I developed an object-oriented guestbook and I have my Class GuestBookEntry : class GuestBookEntry

  • 0

I developed an object-oriented guestbook and I have my Class GuestBookEntry:

class GuestBookEntry {
protected $id;
protected $entryDate;
protected $authorName;
protected $authorMail;  
protected $entryText; 

// getters, setters and specific functions are omitted
}

I also have a mysql table with the same names as columns.

Well, when I fetch guestbook entries, it seems to work, but it only displays the ID and the Date, which where returned by getters. The other things won’t return to the template.

The code looks like this:

public function showEntries() { 
    $query = mysql_query('SELECT * FROM dng_entries ORDER BY id DESC');     
    while($entry = @mysql_fetch_object($query, 'GuestBookEntry')) {
        if(empty($entry)) {
        echo '<font color="white">Keine Eintr&auml;ge vorhanden...</font>';
        } else {    
        var_dump($entry);
        echo '<table class="table table-bordered entryfield" align="right">
                <thead>
                    <tr>
                        <td rowspan="2">'.$entry->getId().'</td>
                        <td width="20%">Datum:</td>
                        <td>Name:</td>
                        <td>Email:</td>
                    </tr>
                    <tr>
                        <td>'.$entry->getEntryDate().'</td>
                        <td>'.$entry->getAuthorName().'</td>
                        <td><a href="mailto:'.$entry->getAuthorMail().'">'.$entry->getAuthorMail().'</a></td>
                </thead>
                <tbody>
                    <tr>
                    <td width="10%" valign="middle">Eintrag:</td>
                    <th colspan="3" valign="top" height="100px">'.$entry->getEntryText().'</td>
                    </tr>
                </tbody>
            </table>';
        }
    }
}

Here’s a var_dump of e.g. object:

object(GuestBookEntry)#2 (5) { ["id":protected]=> string(1) "2" ["entryDate":protected]=> int(1344696811) ["authorName":protected]=> NULL ["authorMail":protected]=> NULL ["entryText":protected]=> NULL }

update: well here is the rest of GuestBookEntry class:

public function __construct($authorName, $authorMail, $entryText) {
       $this->authorName    = $authorName;
       $this->authorMail    = $authorMail;
       $this->entryDate     = time();
       $this->entryText     = $entryText;
    }

    public function getId() {
       return $this->id;
    }
    public function getAuthorName() {
       return (String) $this->authorName;
    }
    public function getAuthorMail() {
       return (String) $this->authorMail;
    }
    public function getEntryDate() {
       return date('d.n.Y', $this->entryDate);
    }
    public function getEntryText() {
       return $this->entryText;
    }

    public function setAuthorName($authorName) {
       $this->authorName=$authorName;
    }   
    public function setAuthorMail($authorMail) {
       $this->authorMail=$authorMail;
    }
    public function setEntryDate($entryDate) {
       $this->entryDate=$entryDate;
    }
    public function setEntryText($entryText) {
       $this->entryText=$entryText;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:53:31+00:00Added an answer on June 9, 2026 at 12:53 pm

    Your problem is case sensitivity. MySQL column names don’t deal with camel case, but PHP see’s a difference between properties based on case such as $entryDate and $entrydate. Stick to lowercase with underscores if you need visual seperation. The reason why id works is it’s all lower case.

    I think if you simply lowercase all your property names that are supposed map to table columns everything will work.

    BTW… The camel case issue with column names may vary based on the OS running the sql server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have domain model developed based on DDD concept, pretty much Object Oriented and
Action script is developed based on object oriented programming but why does it not
Object-Oriented programmers seem to have all the fun. Not only are they treated to
I have been a desktop developer for a few years mostly doing object oriented
I recently developed a class named DocumentWrapper around some ORM document object in Python
A co-worker of mine is taking an Introduction to Object Oriented Programming class and
I learned the object-oriented in Java. Now in develop in C#. This means that
I have a question regarding the integration of business objects developed using Linq To
FastObjects.NET Saves the whole class object(if marked with attribute Persistent ) at once in
I have developed an array based implementation of a hashTable with several stock names,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.