Another little query, and im sure some clever person will find a link, how do i get MySQL & php to output "you are viewing page one of 12" and have links?
EG: Page 1, Page 2 (shows next 8), Page 3 (shows 8 after that)
Thank's all, but the links you give use a simple query to a table alone.
My problem is more complex, the results are issued of two table :
table 'motsbar' and table 'liaison'...
In his article (http://www.sitepoint.com/article/php...-result-sets/5)Kevin Yank put a query only on table 'jokes':
$rs = new MySQLPagedResultSet("select * from jokes where aid=$aid", 5,$cnx);
But what, if the query was complex, (like in his book) ?
Here it is:
$select = 'SELECT DISTINCT ID, JokeText, JokeDate, aid';
$from = ' FROM Jokes';
$where = ' WHERE 1=1';
$aid = $_POST['aid'];
if ($aid != '') { // An author is selected
$where .= " AND AID='$aid'";}
$cid = $_POST['cid'];
if ($cid != '') { // A category is selected
$from .= ', JokeLookup';
$where .= " AND ID=JID AND CID='$cid'";
}
$jokedate = $HTTP_POST_VARS['JokeDate'];
if ($jokedate != '') { // A date is selected
$from .= ', jokes';
$where .= " AND JokeDate='$jokedate'";}
$searchtext = $_POST['searchtext'];
if ($searchtext != '') { // Some search text was specified
$where .= " AND JokeText LIKE '%$searchtext%'";
}?>
<table border="1">
<tr><th>Joke Text</th><th>Options</th><th>Date</th></tr>
<?php
$jokes = @mysql_query($select . $from . $where);
How can be managed this result ?
<?php while ($row = $rs->fetchArray()): ?>
Must I replace $jokes by $rs ?
Bookmarks