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

}
?>

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.