Hi there! First of all Happy New Year to all the community.
I just update the wordpress at the 3.8 version and a pair of codeline I wrote don't work now.

Actually I call the database in a new table I created to have back some data but if yesterday everything worked well actually I get this problem:

"Notice: Trying to get property of non-object in /var/www/vhosts/..."

Any idea? I checked the wordpress improvement for 3.8 but can't understand what's going on.

Cheers

Recommended Answers

All 5 Replies

That means some object you are using is not initialized properly. Can you show the line of code that triggers the error?

Hi there,
thanks for help. Before to paste the code I'd like to ensure you that before the 3.8 update everything were working well.

Here the code into the front-page.php

<!-- Welcome Title -->
<div class="welcome_title">
<h1><?php

global $wpdb;
$day= date("d");
$month = date("m");
$geth1tag = $wpdb->get_row("SELECT testo FROM wp_cronologia WHERE giorno = $day AND mese=$month"); 
echo $day."/".$month." ".$geth1tag->testo;

?></h1></div>
<!-- Welcome Title -->

Thanks for help

Shella

I just checked again and the problem happen when the result is null.
The problem is that I don't know how to manage it here.
The line error is this i think:

$geth1tag = $wpdb->get_row("SELECT testo FROM wp_cronologia WHERE giorno = $day AND mese=$month");

If the query get back some daya everything it's ok.
If the query return nothing I get the problem

I don't know how to launch the query only if this is returning something...

I hope to explained it well.

...by the way it's not connected with 3.8 update.. sorry about that.

Shella

Am not familiar with WP, but I think the get_row should return false or null in that case. Chances are something like this will fix it:

$geth1tag = $wpdb->get_row("SELECT testo FROM wp_cronologia WHERE giorno = $day AND mese=$month"); 
echo $day . "/" . $month . " " . (isset($geth1tag) ? $geth1tag->testo : '');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.