
echo “
“;
$year = $_POST[‘year’];
$year_final = substr($year, strpos($year, “a”) + 1);
$industry = $_POST[‘industry’];
if ( isset( $_GET[‘pag’] ) && !empty( $_GET[‘pag’] ) ){
 $curpage = $_GET[‘pag’];
 }
 else{
 $curpage = 1;
 }
$start_from = ($curpage-1)*10;
 $connection1 = mysql_connect(“localhost”,”admnet_dba”,”!p7p6x2w@”);
 $db = mysql_select_db(“admnet_db”, $connection1);
 mysql_query(“SET NAMES ‘utf8′”);
 mysql_query(“SET CHARACTER SET ‘utf8′”);
if (isset($_POST[‘find’]) || isset($_GET[‘year’]) || isset($_GET[‘industry’]) ) {
if  ((isset($_POST[‘year’]) && !isset($_POST[‘industry’]))  ||  (isset($_GET[‘year’]) &&  !isset($_GET[‘industry’]) ) ){
 if  (isset($_GET[‘year’])){
 $year=$_GET[‘year’];
 $year_final=substr($year, strpos($year, “a”) + 1);
 }
$sql= “SELECT * FROM projects WHERE    `year`  LIKE  ‘%{$year_final}%’ ORDER BY `year` DESC  LIMIT $start_from, 10 “;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $number=0;
 while($row2 = mysql_fetch_assoc($result1)){
 $number++;
 $project=$row2[‘project_name’];
 $desc=$row2[‘project_desc’];
 $year_display=$row2[‘YEAR_DISPLAY’];
 $industry=$row2[‘industry’];
if ($number % 2 != 0) {
echo “
“;
 }
else{
 echo “
“;
}
//echo  $project.””;
 //echo  “
“;
 //echo  $desc.””;
 //echo  “
“;
 //echo  $year_display.””;
 //echo  “
“;
 //echo  $industry.””;
 //echo  “
“;
 //echo  “
“;
 //echo  “
“;
 }
 $sql= “SELECT * FROM projects WHERE `year`  LIKE  ‘%{$year_final}%’ ORDER BY `year` DESC “;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $total_pages = ceil($num_rows / 10);
mysql_close();
echo “
if ($curpage > 1)
 {
 // show << link to go back to page 1
 echo " << “;
 // get previous page num
 $prevpage = $curpage – 1;
 // show < link to go back to 1 page
 echo " < “;
 }
for ($x = ($curpage – 3); $x < (($curpage +3 ) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $total_pages)) { // if we're on current page... if ($x == $curpage) { // 'highlight' it but don't make a link echo "
“;
 // if not current page…
 }
 else{
 // make it a link
 echo ” $x “;
 if ($x == ($curpage+3)){
 if ($x!= $total_pages){
 echo “…”;
 echo ” $total_pages “;}
 }
 } // end else
 } // end if
 } // end for
 if ($curpage != $total_pages)
 {
 // get next page
 $nextpage = $curpage + 1;
 // echo forward link for next page
 echo ” > “;
 // echo forward link for lastpage
 echo ” >> “;
 } // end if
echo “
 “;
 }
elseif ((!isset($_POST[‘year’]) && isset($_POST[‘industry’]))  ||  (!isset($_GET[‘year’]) &&  isset($_GET[‘industry’]) ) ){
 if  (isset($_GET[‘industry’])){
 $industry=$_GET[‘industry’];
}
$sql= “SELECT * FROM projects WHERE    `industry`  LIKE  ‘%{$industry}%’  ORDER BY `year` DESC LIMIT $start_from, 10 “;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $number=0;
 while($row2 = mysql_fetch_assoc($result1)){
 $number++;
 $project=$row2[‘project_name’];
 $desc=$row2[‘project_desc’];
 $year_display=$row2[‘YEAR_DISPLAY’];
 $industry1=$row2[‘industry’];
if ($number % 2 != 0) {
echo “
“;
 }
else{
 echo “
“;
}
}
 $sql= “SELECT * FROM projects WHERE `industry`  LIKE  ‘%{$industry}%’ ORDER BY `year` DESC “;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $total_pages = ceil($num_rows / 10);
mysql_close();
echo “
if ($curpage > 1)
 {
 // show << link to go back to page 1
 echo " << “;
 // get previous page num
 $prevpage = $curpage – 1;
 // show < link to go back to 1 page
 echo " < “;
 }
for ($x = ($curpage – 3); $x < (($curpage +3 ) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $total_pages)) { // if we're on current page... if ($x == $curpage) { // 'highlight' it but don't make a link echo "
“;
 // if not current page…
 }
 else{
 // make it a link
 echo ” $x “;
 if ($x == ($curpage+3)){
 if ($x!= $total_pages){
 echo “…”;
 echo ” $total_pages “;}
 }
 } // end else
 } // end if
 } // end for
 if ($curpage != $total_pages)
 {
 // get next page
 $nextpage = $curpage + 1;
 // echo forward link for next page
 echo ” > “;
 // echo forward link for lastpage
 echo ” >> “;
 } // end if
 echo “
“;
}
elseif ((isset($_POST[‘year’]) && isset($_POST[‘industry’]))  ||  (isset($_GET[‘year’]) &&  isset($_GET[‘industry’]) ) ){
 if  (isset($_GET[‘industry’])){
 $industry=$_GET[‘industry’];
$year=$_GET[‘year’];
 $year_final=substr($year, strpos($year, “a”) + 1);
 }
$sql= “SELECT * FROM projects WHERE    `industry`  LIKE  ‘%{$industry}%’  AND `year`  LIKE  ‘%{$year_final}%’
 ORDER BY `year` DESC LIMIT $start_from, 10 “;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $number=0;
 if ($num_rows==0){
echo “
“;
 }
while($row2 = mysql_fetch_assoc($result1)){
 $number++;
 $project=$row2[‘project_name’];
 $desc=$row2[‘project_desc’];
 $year_display=$row2[‘YEAR_DISPLAY’];
 $industry1=$row2[‘industry’];
if ($number % 2 != 0) {
echo “
“;
 }
else{
 echo “
“;
}
 }
 $sql= “SELECT * FROM projects  WHERE    `industry`  LIKE  ‘%{$industry}%’  AND `year`  LIKE  ‘%{$year_final}%’ ORDER BY `year` DESC”;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $total_pages = ceil($num_rows / 10);
mysql_close();
echo “
if ($curpage > 1)
 {
 // show << link to go back to page 1
 echo " << “;
 // get previous page num
 $prevpage = $curpage – 1;
 // show < link to go back to 1 page
 echo " < “;
 }
for ($x = ($curpage – 3); $x < (($curpage +3 ) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $total_pages)) { // if we're on current page... if ($x == $curpage) { // 'highlight' it but don't make a link echo "
“;
 // if not current page…
 }
 else{
 // make it a link
 echo ” $x “;
 if ($x == ($curpage+3)){
 if ($x!= $total_pages){
 echo “…”;
 echo ” $total_pages “;}
 }
 } // end else
 } // end if
 } // end for
 if ($curpage != $total_pages)
 {
 // get next page
 $nextpage = $curpage + 1;
 // echo forward link for next page
 echo ” > “;
 // echo forward link for lastpage
 echo ” >> “;
 } // end if
echo “
“;
 }
}
 else{
$sql= “SELECT * FROM projects
 ORDER BY `year` DESC LIMIT $start_from, 10 “;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
$number=0;
 while($row2 = mysql_fetch_assoc($result1)){
 $number++;
 $project=$row2[‘project_name’];
 $desc=$row2[‘project_desc’];
 $year_display=$row2[‘YEAR_DISPLAY’];
 $industry=$row2[‘industry’];
if ($number % 2 != 0) {
echo “
“;
 }
else{
 echo “
“;
}
 }
 $sql= “SELECT * FROM projects ORDER BY `year` DESC”;
 $result1 = mysql_query($sql);
 $num_rows = mysql_num_rows($result1);
 $total_pages = ceil($num_rows / 10);
mysql_close();
echo “
if ($curpage > 1)
 {
 // show << link to go back to page 1
 echo " << “;
 // get previous page num
 $prevpage = $curpage – 1;
 // show < link to go back to 1 page
 echo " < “;
 }
for ($x = ($curpage – 3); $x < (($curpage +3 ) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $total_pages)) { // if we're on current page... if ($x == $curpage) { // 'highlight' it but don't make a link echo "
“;
 // if not current page…
 }
 else{
 // make it a link
 echo ” $x “;
 if ($x == ($curpage+3)){
 if ($x!= $total_pages){
 echo “…”;
 echo ” $total_pages “;}
 }
 } // end else
 } // end if
 } // end for
 if ($curpage != $total_pages)
 {
 // get next page
 $nextpage = $curpage + 1;
 // echo forward link for next page
 echo ” > “;
 // echo forward link for lastpage
 echo ” >> “;
 } // end if
echo “
“;
}[/insert_php]
 
  
 

