If I have a table named book
Column 1 = current_user
, Column 2 = page_length
, Column 3 = author
, Column 4 = title
I’d like to select the data from columns 2, 3 and 4 that correspond to the currently logged in user. Is the following correct syntax?
<?
global $user;
$user_id=$user->name;
db_query('SELECT * FROM {book} WHERE current_user=$user_id', $page_length, $author, $title); ?>
Some tips:
$user_id) to use it.db_query.Fixed code: