This is my first post here, but i've lurked for a while.
I'm working on a website but have come across a major stumbling block in the code:
I've managed to structure the search query but have 2 problems:
I dont know how to code the results into the table, and make the table repeat itself 5 times per page (and recognise it needs a new page)
And I cant test the search query because i cant get the results to display.
If any one could answer 1 or more of these problems and/or correct any error's i've made I'd jump for joy, as i feel i've been fumbling in the dark for the last week or so.
Here's my code so far:
Expand|Select|Wrap|Line Numbers
- $connection = mysql_connect($hostname, $username, $password);
- if (!$connection) {
- die("A connection to the server could not be established");
- }
- //remember to select the database!
- mysql_select_db($database) or die("Database could not be selected!");
- //get the values from the form
- $MerchantType = $_POST["MerchantName"];
- $County = $_POST["County"];
- // rows to return
- $limit=10;
- // Build SQL Query
- $query = "SELECT * FROM Testtable where County = '$county'
- ORDER BY MerchantType"; // EDIT HERE and specify your table and field names for the SQL query
- $numresults=mysql_query($query);
- $numrows=mysql_num_rows($numresults);
- ?>
- <?php
- echo "
- <html><body><table>
- <table border="1" bordercolor="#FFCC00" style="background-color:#FFFFFF" width="800" cellpadding="3" cellspacing="3">
- <tr>
- <td width="200" align="left" rowspan=5>Image</td>
- </tr>
- <tr>
- <td width="573" align="left">Name:</td>
- </tr>
- <tr>
- <td height="27" align="left">Telephone:</td>
- </tr>
- <tr>
- <td height="27" align="left">Website:</td>
- </tr>
- <tr>
- <td height="54" align="left">Description:</td>
- </tr>
- </table>
- </html></body></table>;
- ?>
Sam