0

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

2
Contributors
5
Replies
9
Views
3 Years
Discussion Span
Last Post by pritaeas
0

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

0

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

0

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

0

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 : '');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.