Jim R Posted September 3, 2009 Share Posted September 3, 2009 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 https://forums.phpfreaks.com/topic/172990-solved-wordpress-issue-with-mysql-connection/ Share on other sites More sharing options...
fenway Posted September 8, 2009 Share Posted September 8, 2009 Um, where's the connection? Link to comment https://forums.phpfreaks.com/topic/172990-solved-wordpress-issue-with-mysql-connection/#findComment-915016 Share on other sites More sharing options...
Jim R Posted September 8, 2009 Author Share Posted September 8, 2009 It's a require code referring to a connections page, which is linked to my header in Wordpress. I have the problem solved. I moved my custom tables into my WP database. Link to comment https://forums.phpfreaks.com/topic/172990-solved-wordpress-issue-with-mysql-connection/#findComment-915086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.