How can I get a single entry from a custom database table in WordPress?

1 week ago 6
ARTICLE AD BOX

I added a custom table to my database and I want to call on a particular row as defined by the ID and then display the string contents of another column in that row.

The user makes a selection from a drop down box which assigns the ID and this is then queried using SQL.

$industry = $_REQUEST['industry']; global $wpdb; $authority = $wpdb->get_var("SELECT authority FROM $wpdb->tbl_industries WHERE id=$industry"); echo "<p>$authority</p>";

$industry is the user selection, tbl_industries is the table name, id and industry are columns in the table.

There isn't any value being assigned to $authority. Where have I gone wrong?

Read Entire Article