I'm testing this paging script:
http://www.php-mysql-tutorial.com/php-mysql-paging.php
I made a page.html with a search form with the form action: look.php. The
search term from page.html I put in a variable at look.php like this:
$q = $_POST['q'];
Later I try to use it in 2 selects:
$query = "SELECT metadata FROM $table where metadata like '%$q%' LIMIT
$offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
......................
$query = "SELECT COUNT(metadata) AS numrows FROM $table where metadata
like '%$q%'";
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result);
$numrows = $row['numrows'];
Notice the LIKE clauses: they work if I input a string and not a variable
like this: '%dawn%'
The 2 selects above show 1st page fine, but break when I press next: