/    Sign up×
Community /Pin to ProfileBookmark

get error pls advise

I love the theme but get error,
pls advise my friend here:

[code=html]Warning: Missing argument 2 for wpdb::prepare(), called in /public_html/wp-content/themes/jobboard/plugin/includes/stats.php on line 24 and defined in /public_html/wp-includes/wp-db.php on line 1152[/code]

For reference, the script here:
stats.php on line 24,

[code=html]return $wpdb->get_var($wpdb->prepare($query));[/code]

and wp-db.php on line 1152,

[code=html]public function prepare( $query, $args ) {
if ( is_null( $query ) )
return;[/code]

Warning: Missing argument 2 for wpdb::prepare(), called in /public_html/wp-content/themes/jobboard/plugin/includes/ext/jb_stats.php on line 82 and defined in /public_html/wp-includes/wp-db.php on line 1152
jb_stats.php on line 82:

[code=html]$ret = $wpdb->get_var($wpdb->prepare(“SELECT id FROM “.$wpdb->prefix.”jobboard_stats WHERE postid = $this->post_id AND ip = INET_ATON(‘$this->clientip’) AND date >= ‘$date'”));
[/code]

Warning: Missing argument 2 for wpdb::prepare(), called in /public_html/wp-content/themes/jobboard/plugin/includes/ext/jb_stats.php on line 149 and defined in /public_html/wp-includes/wp-db.php on line 1152
jb_stats.php on line 149:

[code=html]return $wpdb->get_var($wpdb->prepare(“SELECT id FROM “.$wpdb->prefix.”jobboard_stats WHERE ip = INET_ATON(‘$ip’) AND date >= ‘$date’;”));[/code]

Warning: mysql_query(): Access denied for user ‘root’@’localhost’ (using password: NO) in /public_html/wp-content/themes/jobboard/plugin/includes/ext/jb_stats.php on line 126
Warning: mysql_query(): A link to the server could not be established in /public_html/wp-content/themes/jobboard/plugin/includes/ext/jb_stats.php on line 126
jb_stats.php on line 126:

[code=html]$result = mysql_query(‘INSERT INTO ‘.$wpdb->prefix.’jobboard_stats (`postid`, `ip`, `date`) VALUES(“‘.$postid.'”, “‘.ip2long($this->clientip).'”, “‘. current_time(‘mysql’).'”)’);[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmMar 25.2015 — You are not passing the second argument in your calls to prepare as clearly defined in the function declaration.
Copy linkTweet thisAlerts:
@rootMar 25.2015 — One thing to remember with error reporting, just because the report says the error is on line 24, does not mean that the error is in that line, all an error report will do is report an error at the point it got confused and had a seizure and dropped dead.

so this

stats.php on line 24,
[code=php]
return $wpdb->get_var($wpdb->prepare($query));[/code]

and wp-db.php on line 1152,
[code=php]
public function prepare( $query, $args ) {
if ( is_null( $query ) )
return;
[/code]


You should post the lines before the stated error.

The other errors are a mixed bag of not passing arguments, no database connection and poor password implementation... I will guess, you are developing on your local PC with something like XAMPP / WAMP / LAMP or one of the many other development environments.
Copy linkTweet thisAlerts:
@adjayaauthorJun 07.2015 — http:127.0.0.1, ginerjm thank you for your advise.
Copy linkTweet thisAlerts:
@NogDogJun 07.2015 — And along with those errors, you are using the deprecated (for many years now) mysql extension, instead of either the mysql[b]i[/b] or PDO database extension.
×

Success!

Help @adjaya spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...