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 7614317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:22:23+00:00 2026-05-31T02:22:23+00:00

Using the following: $last_book = tz_books::getLast($request->db, WHERE book_id='{$request->book_id}’); I get the following php object

  • 0

Using the following:

$last_book = tz_books::getLast($request->db, "WHERE book_id='{$request->book_id}'");

I get the following php object array,

[0] => tz_books Object
    (
        [db:tz_books:private] => com Object

        [id] => 64BEC207-CA35-4BD2
        [author_id] => 4F4755B4-0CE8-4251
        [book_id] => 8FC22AA0-4A60-4BFC
        [date_due] => variant Object

    )

I then want to use the author_id, but for some reason it’s not working.

Trying to use:

$tz_books->author_id;

Using print_r($last_book); prints the array to the console just fine. And Doing the following just to see if the correct variable was being used:

$author = $tz_books->author_id;
print_r($author);

Nothing is printed to the console, and even after digging through the php manual and trying a lot of alternatives, I can’t seem to grab that variable. I’m hoping i’m making a rookie mistake and overlooking something stupid. Thank you for any help!

Edit: Class definition

private $db;
public $id;
public $author_id;
public $book_id;
public $date_due;

public function __construct($db, $values=null) {
    $this->db = $db;
    if ( $values != null ) {
        foreach ( $values as $var => $value ) {
            $this->$var = $value;
        }
    }
}

public static function retrieveAll($db, $where='', $order_by='') {
    $result_list = array();
    $query = 'SELECT '.
            'id, '.
            'author_id, '.
            'book_id, '.
            'date_due '.
        "FROM tz_books $where $order_by";

    $rs = $db->Execute($query);

    while ( !$rs->EOF ) {
        $result_list[] = new tz_books($db, array(
            'id' => clean_id($rs->Fields['id']->Value),
            'author_id' => clean_id($rs->Fields['author_id']->Value),
            'book_id' => clean_id($rs->Fields['book_id']->Value),
            'date_due' => $rs->Fields['date_due']->Value,
        ));
        $rs->MoveNext();
    }
    $rs->Close();
    return $result_list;
}
  • 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-05-31T02:22:25+00:00Added an answer on May 31, 2026 at 2:22 am

    Your result object seems to be an array of books with 1 element.
    Try

    echo $tz_books[0]->author_id;
    

    BTW, it also looks like you’re escaping input by putting single quotes. This is not a reliable/recommended method. Use a database-specific escape function like this

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

Sidebar

Related Questions

Using following code I try to get updated list of checkbuttons' corresponding text values,
I am using following PHP code to connect to MS Access database: $odb_conn =
I'm using the following code to get some data from a table. $collection =
I'm using the following code to get the image filenames from an HTML file.
I am successfully using following strtotime command with PHP 5.3 echo strtotime('last day of
i have this URI. http://localhost/index.php?properties&status=av&page=1 i am fetching basename of the URI using following
I'm currently using the following SQL for retrieving the last seven days worth of
I am using the following code, in the last line when I play the
I'm using the following code: $query = $dbh->prepare(INSERT into crm_order_errors .SET (order_id, number_of_attempts, last_attempt)
I want to display the last March month. I am using the following code,

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.