PHP warning

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
satimis
Forum Newbie
Posts: 3
Joined: Fri Nov 15, 2013 8:12 pm

PHP warning

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP warning

Post by Celauran »

Two seconds on Google led me to this: http://make.wordpress.org/core/2012/12/ ... b-prepare/
satimis
Forum Newbie
Posts: 3
Joined: Fri Nov 15, 2013 8:12 pm

Re: PHP warning

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP warning

Post 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.
satimis
Forum Newbie
Posts: 3
Joined: Fri Nov 15, 2013 8:12 pm

Re: PHP warning

Post 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
Post Reply