Page 1 of 1

PHP warning

Posted: Fri Nov 15, 2013 8:45 pm
by satimis
Hi all,

Warning:

Code: Select all

Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/88/10579588/html/blog/wp-content/plugins/top-position-yahoo-finance/top-position-yahoo-finance.php on line 150 and defined in /home/content/88/10579588/html/blog/wp-includes/wp-db.php on line 992
"top-position-yahoo-finance.php"

Code: Select all

Line 150:
	$credits = $wpdb->get_var($wpdb->prepare("SELECT tpyf_symbol FROM " . $table_name . " WHERE tpyf_category='credits';"));
Please help how to change this line? Thanks

Rgds
satimis

Re: PHP warning

Posted: Fri Nov 15, 2013 8:57 pm
by Celauran
Two seconds on Google led me to this: http://make.wordpress.org/core/2012/12/ ... b-prepare/

Re: PHP warning

Posted: Fri Nov 15, 2013 10:23 pm
by satimis
@ Celauran

Hi,

Thanks

Fixed as follow; (being an user)
/blog/wp-config.php
set:
line 91 @ini_set('display_errors', 0);

I'm interested learning more on coding. Can you help?

satimis

Re: PHP warning

Posted: Fri Nov 15, 2013 11:59 pm
by requinix
satimis wrote:Fixed as follow; (being an user)
/blog/wp-config.php
set:
line 91 @ini_set('display_errors', 0);
No. That is wrong. Do not do that. You are not fixing anything - rather, you're making it worse.

Celauran posted a link to a page that not only explains what the problem is but tells you what you should do to fix it. Do what it says.

Re: PHP warning

Posted: Sat Nov 16, 2013 1:34 am
by satimis
@ requinix,

Sorry, I'm NOT a programmer, having little knowledge on PHP.

Performed following steps:

On /blog/wp-config.php delete

Code: Select all

 @ini_set('display_errors', 0);
change Line 150 as:

Code: Select all

	$credits = $wpdb->get_var($wpdb->prepare("SELECT tpyf_symbol FROM table WHERE id = %d", $id . $table_name . " WHERE tpyf_category='credits';"));
The warning gone. Did I make the change correct? Thanks

satimis