Having some trouble trying to get the results to show on more than just one page.
What is happening is that when i input a subject or zip code, i get results and links on the bottom to show the number of pages, but when i click on them it gives me a broken link error
Here is the code that i have at the top of my html code before the <html> tag begins
Code: if(!isset($_GET['resultsPage'])){
$resultsPage = 1;
} else {
$resultsPage = $_GET['resultsPage'];
}
// Define the number of results per page
$max_results = 9;
// Figure out the limit for the query based
$from = (($resultsPage * $max_results) - $max_results);
that is whats supposed to get the pages, and the number of search results
here is t he code i have inside my <body> tag that echoes the results and builds the links for the pages
Code: // perform the search
$subject = $_POST['subject'];
$location = $_POST['location'];
$sql = "SELECT * FROM tutorProfiles WHERE MATCH(subject, location) AGAINST('$subject*' '$location*' IN BOOLEAN MODE) LIMIT $from, $max_results";
$result = mysql_query($sql) or die("Problem, with Query:".mysql_error());
// Get number of articles, assign value to a variable
$count = mysql_num_rows($result);
echo "<h3>Search Results</h3>";
echo "<p class='resultspara'>There is a total of $count results found on our database.</p>";
$TableRows = mysql_num_rows($result);
$i = 0;
while ($i <$TableRows)
{
//Add resulting tablerow to relvant variable
$tutorId = mysql_result($result, $i, "id");
$first = mysql_result($result, $i, "first");
$school = mysql_result($result, $i, "school");
$degree = mysql_result($result, $i, "degree");
$class = mysql_result($result, $i, "class");
echo"
<div id='profileBox'>
<div id='badgeImg'>
<img src='images/imgBG.png' name='imgBadge' width='76' height='70' align='left' id='imgBadge' />
<h2>$first</h2>
<p>$school<br />
$degree - $class
</p>
</div>
<div id='profleBtn'>
<a href='profile.php?id=$tutorId'><img src='images/linkBtn.png' alt='view Profile' width='150' height='30' border='0' /></a>
</div>
</div>";
// loop through all results and indent number on each loop
$i ++;
} // close while loop
//Beggin Pagination
// Figure out the total number of results in DB:
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tutorProfiles"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_newspage = ceil($total_results / $max_results);
echo "<p style="clear:both;" align="center">n";
// Build Previous Link
if($resultsPage > 1)
{
$prev = ($resultsPage - 1);
echo "<a href="results.php.php?resultsPage=$prev">Previous</a>n ";
}
for($p = 1; $p <= $total_newspage; $p++)
{
if(($resultsPage) == $p)
{
echo "$pn ";
} else {
echo "<a href="result.php?resultsPage=$i">$p</a>n ";
}
}
// Build Next Link
if($resultsPage < $total_newspage)
{
$next = ($resultsPage + 1);
echo "<a href="results.php?resultsPage=$next">Next</a>n";
}
echo "</p>n";
//End pagination Script
Anyway if someone could take a look at the code when i would gladly appreciate it
Thanks in advance
Creating XML with php
I need to creat an XML with php and have successfully produced a valid output. The problem I have is that the XML requirements of the application that will import the XML requires that the XML file
noob question
i traying to do a php form with auto replay for both(me and the user who send me a mail),a using this codeCode: <?php$contact_name = $_POST['emp'];$contact_email =
how to easy edit text, with box? Help.
Hi.I have a little problem. I'm doing a webpage for my aunt and I would like to make it as easy for her as possible to edit the text. So, I am going to make a Admin site where she can login and then I
Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I am coding a registration form. I ask the user a Yes/No question. Depending on the answer I have an
Cant display mysql data
Hey all,I am learning php and my first goal is to create a simple CMS. At the moment I am stuck on not being able to pull page names and their id`s from my DB and combine them into a list of links
Taylor Series Function
So I am working a a project for my intro C++ class, and I am having some trouble with a function for approximating exp(x) using a taylor series. The taylor series approximations for exp(x) is:
Casting Decimals in Oracle
This code worked as a query in DB2, but I am not sure what the syntax is for casting decimals in Oracle:
Re-Order by ID Number
I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database assigns an ID number. The front end displays each upload by ID number. I'm trying to set up the back
Help With editting and deleting form
So look at this image :http://img194.imageshack.us/img194/8272/snapshot5f.png This table prints the titles of entries from a table in a database.. The code that i use for this table is this :Code:
Request for tunning the below query
Hi,