0

I'm working on a WordPress plugin, and I need some help in this.. in this situation, i have already created a table called "wp_pfot", and a row called "title" in that table. I want to be able to check if a value in "title" doesn't exists, and if it doesn't exist, then perform an action. I've already tried this but it doesn't seem to be working.

global $wpdb
$table_name = $wpdb->prefix . "pfot";
$title = "some text";

if(!$wpdb->get_row("SELECT title FROM $table_name WHERE title = '" . $title . "'", 'ARRAY_A')) {
//do something
}

any help would be much appreciated!! thanks...

1 Answer 1

1

ARRAY_A is a constant, not a string.

global $wpdb
$table_name = $wpdb->prefix . "pfot";
$title = "some text";

if($wpdb->get_row("SELECT title FROM $table_name WHERE title = '$title'", ARRAY_A)) {
//do something
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.