phpMyViews - Tutorial

Browsing feature

phpMyViews can split large SELECT results onto different pages and add browsing links to your HTML code only by adding a special LIMIT statement and inserting a special HTML tag!

Just define a SELECT statement like this one (notice the LIMIT command):

SELECT * FROM table1 LIMIT $start,10

Check your syntax: Don't leave spaces after "$start" and only leave one space before "$start".

Now, phpMyViews uses $start as an URL parameter for setting the offset of the LIMIT statement. Just try it

But before you can see anything, you have to include a special tag in the PRE or POST statement: <pmv:browse />

phpMyViews replaces this tag with short browsing links for switching pages. That's it! Isn't it easy ?

Example 2 : Easy browsing

Here is a short example where we use $from as the parameter and 8 datarows on each page:

# MySQL Parameters
  if (
file_exists('pmv_db_config.php')) {

# Actions
$pmv['default'][0]['sql']='SELECT * FROM addresses ORDER BY surname LIMIT $from,2';
$pmv['default'][0]['main']='<tr><td>$surname, $prename</td><td>$address</td><td>$telephone</td></tr>';
$pmv['default'][0]['post']='</table><pmv:browse />';

# execute phpMyViews

Previous page Next page Logo