Jump to content

Using WordPress data to match a query from my data table...


Jim R

Recommended Posts

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'];
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.