|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Tables
Hope someone can advise. If I give my programmer single page (no headers, footers etc) with a Table halfway dowm the page, and ask him to drop the php search code in that table, will the results of the search appear in that table, leaving the rest of the page intact.
Thanks in advance. |
|
#2
|
||||
|
||||
|
Sure, just tell him not to start the php code until the table.
if he doesn't type his <?php before he has to, and type his ?> as soon as he's done, your code should be fine. |
|
#3
|
|||
|
|||
|
thanks, but
thanks, but my programmer insists it cant be done, so I'm going to attempt it myself. Below is the code at the top of the page, where should this go? I've already placed the script i need into a table on the page, however when i run the page the results throw the page into disarray and i appear to lose all the html work.
<?php $pageID =2; include("conf.php"); if(!$action) { $_SESSION['categoryID']=0; } //$national = 1; if(!$display) { $display=20; } $page=1; if($_GET['next_page']) { $page = $_GET['next_page']; } elseif($_GET['prev_page']) { $page = $_GET['prev_page']; } elseif($_GET['page']) { $page = $_GET['page']; } if($page==1) { $start=0; $end=$display; } else { $start=$_GET['start']; $end=$_GET['end']; } $display = $_GET['display']; if(!$display) { $display =20; } if($action=='browse') { $state = $_SESSION['state']; $regionID= $_GET['regionID']; //$categoryID=8; $searchString = "SELECT d.listingID FROM directory d "; $searchString .= " WHERE (d.categoryID=9 OR d.categoryID=12 OR d.categoryID=11)"; if($state){ $searchString .= " AND d.business_state='$state' "; } if($regionID){ $searchString .= " AND d.region =".$regionID; } $searchString .=" ORDER BY d.business_name"; //echo $searchString; $directory1 = mysql_query($searchString,$server); $numItems = mysql_num_rows($directory1); $searchString .=" LIMIT $start, $display;"; $directory = mysql_query($searchString,$server); } if($_GET['search']) { if($_GET['newSearch']){ $_SESSION['searchString']=0; } $regionID = $_GET['regionID']; $_SESSION['regionID'] =''; $state = $_GET['state']; $business_name= $_GET['business_name']; $surrounding = $_GET['surrounding']; $sp = $_GET['sp']; if($_GET['quickSearch']) { $_SESSION['searchString']=''; } if(!$_SESSION['searchString']){ if(is_numeric(substr($sp,0,4))) { $postcode = $sp; }else { $suburb = strtoupper($sp); } $searchString = "SELECT d.listingID FROM directory d "; $searchString .= " WHERE (d.categoryID=9 OR d.categoryID=12 OR d.categoryID=11)"; if(strlen($business_name)>3){ $searchString .= "AND d.business_name REGEXP '$business_name' "; } else{ $searchString .= " AND d.business_name!=''"; } //echo $surrounding; if($surrounding AND ($postcode || $suburb || $regionID)){ if($postcode){ $surroudingSuburbs = mysql_query("SELECT BSPnumber FROM aus_postcodes WHERE Pcode=$postcode",$server); $get_bsp = mysql_fetch_array($surroudingSuburbs); $bspNumber = $get_bsp['BSPnumber']; }if($suburb){ $surroudingSuburbs = mysql_query("SELECT BSPnumber FROM aus_postcodes WHERE Locality REGEXP '$suburb'",$server); $get_bsp = mysql_fetch_array($surroudingSuburbs); $bspNumber = $get_bsp['BSPnumber']; } if(mysql_num_rows($surroudingSuburbs)){ $searchString .= " AND d.szone =".$bspNumber; } }else{ if($postcode){ $searchString .= " AND d.business_postcode = $postcode"; } if($suburb){ $searchString .= " AND d.business_suburub ='$suburb'"; } if($_GET['regionID']){ $regionID=$_GET['regionID']; $searchString .= " AND d.region ='$regionID'"; } } $searchString .=" GROUP BY listingID ORDER BY listingID"; // echo $searchString; $_SESSION['searchString']=$searchString; } else { $searchString=$_SESSION['searchString']; } $directory = mysql_query($searchString,$server); $numItems = mysql_num_rows($directory); $searchLimit =$searchString." LIMIT $start, $display"; // echo $searchString; $directory = mysql_query($searchLimit,$server); $action='browse'; } if($numItems%$display==0) { $num_pages = (int)($numItems/$display); } else { $num_pages = (int)($numItems/$display)+1; } if($num_pages==0) { $num_pages = 1; } ?> <?php if($action=='') { $_SESSION['state']=''; $_SESSION['regionID']=''; $_SESSION['categoryID']=''; ?> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|