Copy link to clipboard
Copied
Hello,
I have gotten some code for pagination, and I have gotten it to work for the first page. However, when I click on the links to the next pages, the results are blank.
So, apparently the problem is that I am not passing the correct variable to these next pages.
The problem is that my output that I'm trying to paginate is a little fancy, and it's hard for me to tell what variable to pass from page to page, and whether or not this variable is an array.
My output code is below. This is all kicked off after a user submits a value for the variable "$find" via an HTML form. What should I use as a variable to pass from page to page?
Thanks in advance,
John
$result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
or die(mysql_error());
if(mysql_num_rows($result)>0){
while($table=mysql_fetch_row($result)){
print "<p class=\"topic\">$table[0]</p>\n";
$r=mysql_query("SELECT * , votes_up - votes_down AS effective_vote FROM `$table[0]` ORDER BY effective_vote DESC LIMIT $offset, $rowsperpage");
print "<table class=\"navbar\">\n";
while($row=mysql_fetch_array($r)){
print "<tr>";
print "<td>".'<a href="http://'.$row['site'].'" class="links2">'.$row['site'].'</a>'."</td>";
print "<td class='votes'>".'<span class="votes_count" id="votes_count'.$row['id'].'">'.number_format($effective_vote).'</span>'."</td>";
print "<td class='ballot'>".'<span class="button" id="button'.$row['id'].'">'.'<a href="javascript:;" class="cell1" id="'.$row['id'].'">'.Vote.'</a>'.'</span>'."</td>";
}
print "</tr>\n";
}
print "</table>\n";
Copy link to clipboard
Copied
I'm just curious for one thing. The code below :
$result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
Should it be SELECT * FROM TABLENAME ? Basically, to pass the variable, you have to include the correct URL parameter. For example if u want to view user details, u have to pass the user_id.
Copy link to clipboard
Copied
>$result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
>
>Should it be SELECT * FROM TABLENAME ?
The OP is searhing the system tables for a user table in a database. With most dbms's you would select from the system table for the object. MySql has the Show command.
http://dev.mysql.com/doc/refman/5.0/en/show-tables.html