Jim R Posted August 30, 2011 Share Posted August 30, 2011 I have a data table inside my WP database that has coachFirst, coachLast, email, school as columns. I'm trying to create a page that acknowledges the User (that part works). From there it matches the first and last names in my data table then echos the school where they coach. It's the latter I can't get to work. Example, for me it looks like Jim R Jim #lastName# It show the name of the team I coach below that. It doesn't...of course. Here is the code/query I'm using: $current_user = wp_get_current_user(); $current_first = $current_user->user_firstname; $current_last = $current_user->user_lastname; echo 'Username: ' . $current_user->user_login . '<br />'; echo $current_first . ' ' . $current_last; $query = "SELECT * FROM schools WHERE coachFirst='$current_first' AND coachLast='$current_last'"; $result = mysql_query ($query); while ($result) { echo $result['school']; } Quote Link to comment https://forums.phpfreaks.com/topic/246003-using-wordpress-data-to-match-a-query-from-my-data-table/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.