Fetch a single row from a custom table for to a given ID
When I want to get a single row from a custom table of my WordPress database by providing a username through a function call, it does not work. When I mention the username in the where
clause of the query, however, it works. Why is that?
I am using the following code:
function gettingonly($phl) {
global $wpdb;
$mylink = $wpdb-get_row(
SELECT *
FROM $wpdb-wp_philosophy_philosopher
WHERE philosopher=%s,
$phl
);
if ($mylink) {
print input type='text' value=' . $mylink-philosopher . '
input type='text' value=' . $mylink-about . ';
}
}
Is this the right method to fetch a row by providing the value through the PHP function?