Jump to content

[SOLVED] WordPress issue with MySQL connection


Jim R

Recommended Posts

The mysql_select_db line is causing my WordPress widgets to disappear.  I tried putting in a require statement in my theme's header, but then the code below doesn't work as it should. 

 

I'm new enough to connecting to MySQL that I'm not sure how else to connect to my database, aside from I have below.

 

<?php
$wp_tagID = get_query_var('tag_id');  


mysql_select_db("jwrbloom_hhr");
  
$query = 'SELECT * FROM playerRank';
$results = mysql_query($query);
while($line = mysql_fetch_assoc($results)) {

if ($line['wpID'] == $wp_tagID)  {

echo '<div class="player">';
echo '<div>' . $line['nameFirst'] . ' ' . $line['nameLast'] . '</div>';
echo '<div><strong>' . $line['height'] . ' ';
	if ($line['position'] == 'PG')  {echo 'Point Guard';}
	elseif ($line['position'] == 'SG')  {echo 'Shooting Guard';}
	elseif ($line['position'] == 'SF')  {echo 'Small Forward';}
	elseif ($line['position'] == 'PF')  {echo 'Power Forward';}
	elseif ($line['position'] == 'C')  {echo 'Center';}
	echo '</strong></div>';
echo '<div><strong>' . $line['hschool'] . '</strong></div>';

echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.jpg" width=150 height=200></div>

</div>';
}

}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.