mikemessiah Posted April 16, 2008 Share Posted April 16, 2008 Hi all, I have a site that sucks results from a mssql db, I would like to display only 5 reults per page. How would I achive this? I figure that you would use a query with a LIMIT 5 some how and with a next and back button that has a 'X' + 5 that will change the query but i am really not syre how to do it... any ideas? Please help! Thanks in advance. Quote Link to comment Share on other sites More sharing options...
AP81 Posted April 16, 2008 Share Posted April 16, 2008 Lets say your table has 50 rows: SELECT * FROM table1 LIMIT 0,5 will output the first 5 SELECT * FROM table1 LIMIT 5,10 will output rows 5 to 10 SELECT * FROM table1 LIMIT 10,15 will output rows 10 to 15 Get it? So what you need to do is display a pager which passes a parameter to the page, i.e. Page (1) (2) (3)... Clicking 3 will pass '3' to the page, so you know you query will be limit 10,15 (15 = 3 x 5 and 10 is 15 - 5 result per page) So lets say your query as a whole contains 47 results, you know that you will have to display Page (1)..(10). 45 / 9 is 9.4, so will need 10 pages. You would do something like this (copy and paste this code so you get an idea of what is happening): $db_result_count = 47; // lets pretend there are 47 results $pages = ceil($db_result_count / 5); // round it up to the nearest whole number for ($i = 1; $i <= $pages; $i++) { echo "<a href=\"$PHP_SELF?page=$i\">$i</a> "; } Now when a link is clicked, the page will redirect to itself, and you can use $_GET["page"] to find what you have clicked, and do a query. You can beautify it by making a nice css style and apply it to the <a> tag, i.e. <a class="pager" ...> Quote Link to comment Share on other sites More sharing options...
mikemessiah Posted April 16, 2008 Author Share Posted April 16, 2008 I think I get what you are saying... I am not totally sure though... ??? sorry... my noobness prevails... my code looks like this. <?php if(isset($_POST['Prop_Type'])) { $Prop_TypeVar = $_POST['Prop_Type']; $PriceFromVar = $_POST['PriceFrom']; $PriceToVar = $_POST['PriceTo']; $OnShowVar = $_POST['OnShow']; $BedVar = $_POST['Bed']; $BathVar = $_POST['Bath']; $LoungeVar = $_POST['Lounge']; $GarageVar = $_POST['Garage']; $TypeVar = $_POST['Type']; $firstChoiceVar = $_POST['firstChoice']; $secondChoiceVar = $_POST['secondChoice']; $thirdChoiceVar = $_POST['thirdChoice']; $forthChoiceVar = $_POST['forthChoice']; $myServer = "sql3.soukopproperty.co.za"; $myUser = "*****"; $myPass = "*****"; $myDB = "webuploader"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //declare the SQL statement that will query the database $query = "SELECT * FROM webinfo WHERE Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' order by Price asc LIMIT 0,5 "; $result = mssql_query($query); //if(!$result) error_message(sql_error()); ?> <head> <title>Soukop Property Group - Propery for Sale and Rent</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Property in KZN Sales, Properties KZN, purchasing, letting and investment opportunities" /> <meta name="keywords" content="Property Sales, rentals, purchasing, letting and investment opportunitiess" /> <meta name="keyphrases" content="Property Sales, purchasing, letting and investment opportunities" /> <link href="css/stylin.css" rel="stylesheet" type="text/css"/> <script src="form.js" type="text/javascript"></script> </head> <body> <h1>Property in KZN Sales, Properties for Sale, Looking to Rent, Rentals</h1> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\header.php') ; ?> <div id="content"> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\search-form.php') ; ?> <div id="content-right"> <?php while($query_data = mssql_fetch_array($result)) { $ID = $query_data["ID"]; $Street_Address = $query_data["Street_Address"]; $Price = $query_data["Price"]; $Mandate = $query_data["Mandate"]; $Onshow = $query_data["Onshow"]; $Onshow_Desc = $query_data["Onshow_Desc"]; $Bed = $query_data["Bed"]; $Bath = $query_data["Bath"]; $Lounge = $query_data["Lounge"]; $Garage = $query_data["Garage"]; $Heading = $query_data["Heading"]; $Body = $query_data["Body"]; $Agent_Pic = $query_data["Agent_Pic"]; $Agent_Name = $query_data["Agent_Name"]; $Agent_Tel = $query_data["Agent_Tel"]; $Agent_Cell = $query_data["Agent_Cell"]; $Type = $query_data["Type"]; $Zone1 = $query_data["Zone1"]; $Zone2 = $query_data["Zone2"]; $Zone3 = $query_data["Zone3"]; $Zone4 = $query_data["Zone4"]; $Photo1 = $query_data["Photo1"]; $Photo2 = $query_data["Photo2"]; $Photo3 = $query_data["Photo3"]; $Photo4 = $query_data["Photo4"]; $Photo5 = $query_data["Photo5"]; $Photo6 = $query_data["Photo6"]; $Photo7 = $query_data["Photo7"]; $Photo8 = $query_data["Photo8"]; ?> <?php require($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\listing.php') ; } ?> </div><!--END #content-right--> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\footer.php') ; } ?> ?> That While statement spits the results out... over and over um... can you advise me? Quote Link to comment Share on other sites More sharing options...
shikeh Posted April 16, 2008 Share Posted April 16, 2008 Hi You shold only add to the query the "limit" parameter But, dont use 0 in the first parameter It should be like "... LIMIT $first_row, 5" now, every paging you'll add/decrease 5 to/from $first_row, and than you'll show the next/prev 5 records Also, you can make the same with the number of rows (as results in Google) and let the user decide how many records he'll see then the query will end with "... LIMIT $first_row, $rows_per_page" All the best Shikeh Quote Link to comment Share on other sites More sharing options...
Barand Posted April 16, 2008 Share Posted April 16, 2008 MSsql - you can't expect something from the microshaft stable to have the convenience of MySQL's LIMIT clause. To select the first 5 SELECT TOP 5 * FROM mytable. So far so good, but now the fun starts. To get the second 5 SELECT TOP 5 * FROM mytable WHERE id NOT IN (SELECT TOP 5 id FROM mytable) Quote Link to comment Share on other sites More sharing options...
mikemessiah Posted April 22, 2008 Author Share Posted April 22, 2008 haha wow been working on this for a while... MSSQL is terrible with limits why cant it be easy like with MYSQL, Can anyone explain how I can add the links to a post that will display "next" and "back" pages? Here is my code for the results page: <?php if(isset($_POST['Prop_Type'])) { $Prop_TypeVar = $_POST['Prop_Type']; $PriceFromVar = $_POST['PriceFrom']; $PriceToVar = $_POST['PriceTo']; $OnShowVar = $_POST['OnShow']; $BedVar = $_POST['Bed']; $BathVar = $_POST['Bath']; $LoungeVar = $_POST['Lounge']; $GarageVar = $_POST['Garage']; $TypeVar = $_POST['Type']; $CountryVar = $_POST['country']; $ProvinceVar = $_POST['province']; $CityVar = $_POST['city']; $TownVar = $_POST['town']; $myServer = "sql3.***********.co.za"; $myUser = "********"; $myPass = "*********"; $myDB = "webuploader"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); if( $ProvinceVar == '' or $ProvinceVar == 'Any' ) { $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2 like '%' and Zone3 like '%' and Zone4 like '%' order by Price asc "; } if( $CityVar == '' or $CityVar == 'Any' ) { $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2='$ProvinceVar' and Zone3 like '%' and Zone4 like '%' order by Price asc "; } if( $TownVar == '' or $TownVar == 'Any' ) { $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2='$ProvinceVar' and Zone3='$CityVar' and Zone4 like '%' order by Price asc "; } else $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2='$ProvinceVar' and Zone3='$CityVar' and Zone4='$TownVar' order by Price asc "; // This will be second page query! $query = "SELECT TOP 10 * FROM webinfo WHERE ID NOT IN (SELECT TOP 5 * ID FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2 like '%' and Zone3 like '%' and Zone4 like '%' Order by Price asc) and Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2 like '%' and Zone3 like '%' and Zone4 like '%' Order by Price asc" $myServer = "sql3.soukopproperty.co.za"; $myUser = "main"; $myPass = "messiah"; $myDB = "webuploader"; $result = mssql_query($query); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <title>Soukop Property Group - Propery for Sale and Rent</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Property in KZN Sales, Properties KZN, purchasing, letting and investment opportunities" /> <meta name="keywords" content="Property Sales, rentals, purchasing, letting and investment opportunitiess" /> <meta name="keyphrases" content="Property Sales, purchasing, letting and investment opportunities" /> <link href="/css/stylin.css" rel="stylesheet" type="text/css"/> <script src="form.js" type="text/javascript"></script> <link rel="shortcut icon" href="http://www.soukopproperty.co.za/wwwroot/icon.ico" /> </head> <body onLoad="setProvince();"> <?php echo "$query" ?> <h1>Property in KZN Sales, Properties for Sale, Looking to Rent, Rentals</h1> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\header.php') ; ?> <div id="content"> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\search-form.php') ; ?> <div id="content-right"> <?php if(!$result) echo 'Sorry... No Results were found.'; while($query_data = mssql_fetch_array($result)) { $Prop_Type = $query_data["Prop_Type"]; $ID = $query_data["ID"]; $Street_Address = $query_data["Street_Address"]; $Price = $query_data["Price"]; $Mandate = $query_data["Mandate"]; $Onshow = $query_data["Onshow"]; $Onshow_Desc = $query_data["Onshow_Desc"]; $Bed = $query_data["Bed"]; $Bath = $query_data["Bath"]; $Lounge = $query_data["Lounge"]; $Garage = $query_data["Garage"]; $Heading = $query_data["Heading"]; $Body = $query_data["Body"]; $Agent_Pic = $query_data["Agent_Pic"]; $Agent_Name = $query_data["Agent_Name"]; $Agent_Tel = $query_data["Agent_Tel"]; $Agent_Cell = $query_data["Agent_Cell"]; $Type = $query_data["Type"]; $Zone1 = $query_data["Zone1"]; $Zone2 = $query_data["Zone2"]; $Zone3 = $query_data["Zone3"]; $Zone4 = $query_data["Zone4"]; $Photo1 = $query_data["Photo1"]; $Photo2 = $query_data["Photo2"]; $Photo3 = $query_data["Photo3"]; $Photo4 = $query_data["Photo4"]; $Photo5 = $query_data["Photo5"]; $Photo6 = $query_data["Photo6"]; $Photo7 = $query_data["Photo7"]; $Photo8 = $query_data["Photo8"]; ?> <?php require($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\listing.php') ; ?> <?php } ?> </div><!--END #content-right--> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\footer.php') ; } ?> Also those three IF statements at the top... Is there a way to put OR in them? like it only runs the last statement... Byron Quote Link to comment Share on other sites More sharing options...
Barand Posted April 22, 2008 Share Posted April 22, 2008 This is my method for processing complex searches from user options http://www.phpfreaks.com/forums/index.php/topic,89842.msg360739.html#msg360739 + + + A thought which may make MSSQL LIMIT searches easier. When you have your query WHERE clause formulated, SELECT id FROM table WHERE whatever and store the IDs into an $_SESSION['idArray']. The IDs are now in the right order for the pages so you can use $ids = array_slice ($_SESSION['idArray'], $x, $y); where x and y are the same as they would be in a MySQL LIMIT x,y clause $ids is an array of the (5) ids to dispay on page N so you can then $idlist = join(',', $ids); $sql = "SELECT * FROM table WHERE id IN ($idlist)"; This gives the records to be displayed on thar page Quote Link to comment Share on other sites More sharing options...
mikemessiah Posted April 23, 2008 Author Share Posted April 23, 2008 Your way looks way better but i am not 100% sure how to do it properly. Gonna have to stare at what you have done for a while b4 i get it i suppose lol. Thanks man! With regards to my IF statments if( $ProvinceVar == '' or $ProvinceVar == 'Any' ) { $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2 like '%' and Zone3 like '%' and Zone4 like '%' order by Price asc "; } if( $CityVar == '' or $CityVar == 'Any' ) { $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2='$ProvinceVar' and Zone3 like '%' and Zone4 like '%' order by Price asc "; } if( $TownVar == '' or $TownVar == 'Any' ) { $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2='$ProvinceVar' and Zone3='$CityVar' and Zone4 like '%' order by Price asc "; } else $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2='$ProvinceVar' and Zone3='$CityVar' and Zone4='$TownVar' order by Price asc "; Is there a betterway to do this? it is for Zone2, Zone3, Zone4 so that If they select "Any" or it sends back blank then it will query VAR like '%' It is not working at the moment I think it is only running the last IF statement even when the top one is selected as Any Quote Link to comment Share on other sites More sharing options...
mikemessiah Posted April 23, 2008 Author Share Posted April 23, 2008 Sorry... here is a link to see the form http://www.soukopproperty.co.za Quote Link to comment Share on other sites More sharing options...
Barand Posted April 23, 2008 Share Posted April 23, 2008 Is there a betterway to do this? it is for Zone2, Zone3, Zone4 so that If they select "Any" or it sends back blank then it will query VAR like '%' Just leave it out of the query completely in that case Quote Link to comment Share on other sites More sharing options...
mikemessiah Posted April 23, 2008 Author Share Posted April 23, 2008 Thanks man I bring all new angles to the word noob... :-\ haha, is my IF statement correct? Quote Link to comment Share on other sites More sharing options...
mikemessiah Posted April 23, 2008 Author Share Posted April 23, 2008 well anyone who actually knows what they are doing will laugh alot when they see this code... but it does work hahaha <?php if(isset($_POST['Prop_Type'])) { $Prop_TypeVar = $_POST['Prop_Type']; $PriceFromVar = $_POST['PriceFrom']; $PriceToVar = $_POST['PriceTo']; $OnShowVar = $_POST['OnShow']; $BedVar = $_POST['Bed']; $BathVar = $_POST['Bath']; $LoungeVar = $_POST['Lounge']; $GarageVar = $_POST['Garage']; $TypeVar = $_POST['Type']; $CountryVar = $_POST['country']; $ProvinceVar1 = $_POST['province']; $CityVar1 = $_POST['city']; $TownVar1 = $_POST['town']; $ProvinceVar = "= '$ProvinceVar1'"; $CityVar = "= '$CityVar1'"; $TownVar = "= '$TownVar1'"; $myServer = "sql3.soukopproperty.co.za"; $myUser = "main"; $myPass = "messiah"; $myDB = "webuploader"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); if( $TownVar1 == '' or $TownVar1 == 'Any' ) {$TownVar = " like '%'";} if( $CityVar1 == '' or $CityVar1 == 'Any' ) {$CityVar = " like '%'";} if( $ProvinceVar1 == '' or $ProvinceVar1 == 'Any' ) {$ProvinceVar = " like '%'";} $query = "SELECT top 5 * FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2$ProvinceVar and Zone3$CityVar and Zone4$TownVar order by Price asc "; // This will be second page query! $query = "SELECT TOP 10 * FROM webinfo WHERE ID NOT IN (SELECT TOP 5 * ID FROM webinfo WHERE Prop_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2$ProvinceVar and Zone3$CityVar and Zone4$TownVar order by Price asc) and PProp_Type='$Prop_TypeVar' and Price between '$PriceFromVar' and '$PriceToVar' and OnShow $OnShowVar and Bed $BedVar and Bath $BathVar and Lounge $LoungeVar and Garage $GarageVar and [Type]='$TypeVar' and Zone1='$CountryVar' and Zone2$ProvinceVar and Zone3$CityVar and Zone4$TownVar order by Price asc" $myServer = "sql3.**********.co.za"; $myUser = "*******"; $myPass = "*******"; $myDB = "webuploader"; $result = mssql_query($query); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <title>Soukop Property Group - Propery for Sale and Rent</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Property in KZN Sales, Properties KZN, purchasing, letting and investment opportunities" /> <meta name="keywords" content="Property Sales, rentals, purchasing, letting and investment opportunitiess" /> <meta name="keyphrases" content="Property Sales, purchasing, letting and investment opportunities" /> <link href="/css/stylin.css" rel="stylesheet" type="text/css"/> <script src="form.js" type="text/javascript"></script> <link rel="shortcut icon" href="http://www.soukopproperty.co.za/wwwroot/icon.ico" /> </head> <body onLoad="setProvince();"> <h1>Property in KZN Sales, Properties for Sale, Looking to Rent, Rentals</h1> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\header.php') ; ?> <div id="content"> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\search-form.php') ; ?> <div id="content-right"> <p class="white"><?php echo "$query";?> </p> <?php //if(!$result) echo 'Sorry... No Results were found.'; while($query_data = mssql_fetch_array($result)) { $Prop_Type = $query_data["Prop_Type"]; $ID = $query_data["ID"]; $Street_Address = $query_data["Street_Address"]; $Price = $query_data["Price"]; $Mandate = $query_data["Mandate"]; $Onshow = $query_data["Onshow"]; $Onshow_Desc = $query_data["Onshow_Desc"]; $Bed = $query_data["Bed"]; $Bath = $query_data["Bath"]; $Lounge = $query_data["Lounge"]; $Garage = $query_data["Garage"]; $Heading = $query_data["Heading"]; $Body = $query_data["Body"]; $Agent_Pic = $query_data["Agent_Pic"]; $Agent_Name = $query_data["Agent_Name"]; $Agent_Tel = $query_data["Agent_Tel"]; $Agent_Cell = $query_data["Agent_Cell"]; $Type = $query_data["Type"]; $Zone1 = $query_data["Zone1"]; $Zone2 = $query_data["Zone2"]; $Zone3 = $query_data["Zone3"]; $Zone4 = $query_data["Zone4"]; $Photo1 = $query_data["Photo1"]; $Photo2 = $query_data["Photo2"]; $Photo3 = $query_data["Photo3"]; $Photo4 = $query_data["Photo4"]; $Photo5 = $query_data["Photo5"]; $Photo6 = $query_data["Photo6"]; $Photo7 = $query_data["Photo7"]; $Photo8 = $query_data["Photo8"]; ?> <?php require($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\listing.php') ; ?> <?php } require($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\nextorback.php') ; ?> </div><!--END #content-right--> <?php require_once($_SERVER['DOCUMENT_ROOT'].'C:\Domains\soukopproperty.co.za\wwwroot\includes\footer.php') ; } ?> How do i make the links/form that takes it to the next and back etc. (I have the query...) how do i do the rest? Quote Link to comment Share on other sites More sharing options...
Barand Posted April 23, 2008 Share Posted April 23, 2008 if you are on page $p, $prev = $p-1 and $next=$p+1 <a href='myscript.php?page=$prev'>last</a> <a href='myscript.php?page=$next'>next</a> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.