Jump to content

mrdobalina

New Members
  • Posts

    1
  • Joined

  • Last visited

mrdobalina's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have started a project using php for the first time. I found this site from a google search! I hope to meet you all and learn a lot.
  2. <?php $con=mysqli_connect("address","username","pass","db name"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } if (!(isset($pagenum))) { $pagenum = 1; } $data = mysqli_query($con,"SELECT * FROM info"); $rows = mysql_num_rows($data); $page_rows = 15; $last = ceil($rows/$page_rows); if($pagenum < 1); { $pagenum = 1; } elseif ($pagenum > $last); { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; $result = mysql_query($con,"SELECT * FROM topsites $max") or die(mysql_error()); echo "<table border='1' class='boldtable' cellpadding='2'> <tr> <th>Creditor</th> <th>dd/mm/yyyy</th> <th>Credit Score</th> <th>State</th> <th>Income</th> <th>Approval</th> <th>Credit Line</th> <th>Interest</th> <th>Comment</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['creditor'] . "</td>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['fako'] . "</td>"; echo "<td>" . $row['state'] . "</td>"; echo "<td>" . $row['income'] . "</td>"; echo "<td>" . $row['approval'] . "</td>"; echo "<td>" . $row['creditline'] . "</td>"; echo "<td>" . $row['interest'] . "</td>"; echo "<td>" . $row['comments'] . "</td>"; echo "</tr>"; } echo "</table>"; echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> "; } echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> "; } mysqli_close($con); ?> All I want are the pages broken up into pages. It is going wrong somewhere before my table. Can someone help me out? Thank you!
×
×
  • 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.