Hi,
I am very new to php (three weeks) and i am trying to do a search database etc...
im doing ok ( i think...lol)
I am getting my results to show in the order i want now, but i want my results to show a max of 10 on each page... the problem is I dont know how to only show 10 results on one page and to have a next button that will show the next 10 and so on and so on.
please please could someone help as it is doig my head in!!
here is my code so far
<?php
mysql_connect (localhost, root, louvain);
mysql_select_db (directory);
if (empty($townorcounty))
{
$townorcounty = '%';
}
if (empty($county))
{
$county = '%';
}
$result = mysql_query ("SELECT * FROM `company` WHERE (`town` LIKE '$townorcounty%' OR `county` LIKE '$townorcounty%') ORDER BY package");
if (!mysql_num_rows($result))
{
print ('No search results');
}
else
{
print ('<table width="472" border="0" cellpadding="0" cellspacing="5" class="table">');
$ID = 0;
while ($row = mysql_fetch_array($result))
{
# Create the HTML image code.
//<a href="mailto:">email</a>
//<a href="http://www.">www.spacekitchens.co.uk</a>
$emailcode = '<a href="mailto:'.$row['emailaddress'].'"><img src="' . $row['email'] . '" alt="Click Here To Email" border="0" />';
$imgcode = '<a href="'.$row['website'].'"><img src="' . $row['photo'] . '" alt="Company Logo" border="0" />';
$webcode = '<a href="'.$row['website'].'"><img src="' . $row['websiteimg'] . '" alt="go to website" border="0" />';
$linecode = '<img src="' . $row['space'] . '" alt="go to website" border="0" />';
$today = date("d/m/Y - ");
//$variable1=$row["Company"];
//$variable2=$row["title"];
//$variable3=$row["county"];
//print ('<tr>');
//print ('<td><strong>');
//print ("$variable1");
//print ("$variable2");
//print ("$variable3");
print ('<td><strong>');
//print $today;
print $row['Company'];
print ('</strong>');
print $row['title'];
print('</td>');
print('</tr>');
print ('<tr>');
print ('<td>');
print $row['address'];
print $row['town'];
print $row['county'];
print $row['postcode'];
print('</td>');
print('</tr>');
print ('<tr>');
print ('<td>');
print $imgcode;
print('</td>');
print('</tr>');
print ('<tr>');
print ('<td>');
print $row['desc'];
print('</td>');
print('</tr>');
print ('<tr>');
print ('<td>');
print $emailcode;
print $webcode;
print('</td>');
print('</tr>');
print ('<tr>');
print ('<td>');
print $linecode;
print('</td>');
print('</tr>');
++$ID;
}
print ('</table>');
}
?>