Wordpress Custom SQL Table with UserID Filter for results
UPDATE: I have realised that I need to use a plugin like PHP Snipping or Insert PHP to make this work, I have updated my screen shots to reflect where Im upto from my research.
The code is working and outputting the right User ID but the SQL is not echoing the Table data, if you have some advice on where I might of gone wrong would be great.
?php
global $wpdb;
$uid = get_current_user_id();
$sql = $wpdb-prepare(SELECT * FROM sr3_characters WHERE wp_id = $uid );
$results = $wpdb-get_results( $sql);
?
html
body
table border=1
tbody
tr
thName/th
thRace/th
thGender/th
thAge/th
/tr
tr
td?php foreach ($results as $value) { echo $value-char_namebr; }; ?/td
td?php foreach ($results as $value) { echo $value-char_racebr; }; ?/td
td?php foreach ($results as $value) { echo $value-char_genderbr; }; ?/td
td?php foreach ($results as $value) { echo $value-char_agebr; }; ?/td
/tr
/tbody
/table
/body
/html