New to $WPDB, can’t figure out syntax…
-
I’m having a hard time getting my WP to work well with a secondary database, as it’s affecting Pages with widgets on it. Reading one topic, I moved my table into my WP database. I’m hoping it solves my problem. Anyway, here is the code. I’m not sure why it’s not working:
<?php $wp_tagID = get_query_var('tag_id'); $line = $wpdb->get_results("SELECT * FROM $wpdb->playerRank"); if ($line['wpID'] == $wp_tagID) { echo '<div class="player">'; echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.jpg"></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'] . '<br /> Class of ' .$line['year'] . '</strong></div>'; echo '</div>'; } } echo '<div class=recent>--Recent Articles--</div>'; ?>
Here is the best page to see what it’s doing:
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘New to $WPDB, can’t figure out syntax…’ is closed to new replies.