Add pagination or create page from mysql with wordpress plugin shortcode?
-
I am trying to make a list of players and display them on a page, then I want to show their scores on a new page when a players name is clicked, how can i do this, this is a wordpress plugin.
functions.php
function bowling_players_list()
{
include(‘shortcodeplayers.php’);
}
add_shortcode(‘bowlingplayers’, ‘bowling_players_list’);shortcodeplayers.php
<?php
//Browse the results
global $wpdb;
$table = $wpdb->prefix . “bowling_plus_players”;
$req = “SELECT * from $table order by player_name;”;
//TODO Test variable
$res = mysql_query($req);
$number = mysql_num_rows($res);
if ($number == 0) {
_e(‘No results for the moment’, ‘Bowling_Plus’);
} else {
while ($games = mysql_fetch_array($res)) {
echo ‘<table border=”1″><tr><td>’;
echo ‘‘;
echo $games[‘player_name’] . $games[‘player_lname’] . ‘‘;
echo ‘</td></tr></table>’;
}
}
?>I want it to go to a new page that only shows scores, I have not created template.php yet since I dont know what to put in it or if thats even the right way to go.
The current page is https://127.0.0.1/?page_id=1
how to i generate a new page with only the scores when the link is clicked?
- The topic ‘Add pagination or create page from mysql with wordpress plugin shortcode?’ is closed to new replies.