"; print "Page: "; if ($offset == 1) { $currenthit = $offset; } else { $currenthit = $offset + 1; } if (($numrows - $currenthit) >= $limit ) { $lasthit = $currenthit + ($limit - 1); } else { $lasthit = $numrows; } $selectedPg = sprintf("%.0f", (($currenthit/$limit) + 1)); $j= 1; for ($i=1; $i<=$pages; $i++) { $newoffset = $limit * ($i - 1); if($selectedPg == $i) { print "$i | "; } else { print "$i |"; } $j++; if ($j == 30) { echo "
"; $j = 1; } } echo " "; if($offset!=0) { $cr=$offset-$limit; echo "Previous"; if ($offset+($offset) >= $numrows) { echo "  "; } else { echo " | "; } } if($offset<$numrows && (($numrows-$offset)>$limit)) { echo "Next"; } print ""; print ""; } function pagewisesmarty($numrows,$limit,$currenthit,$offset,$lnkScr,$lnkParam="") { global $action,$cr,$lnkscr; $pages=intval($numrows/$limit); if ($numrows % $limit) { $pages++; } $str=""; $str.= ""; $str.= ""; $str.= "
Page: "; if ($offset == 1) { $currenthit = $offset; } else { $currenthit = $offset + 1; } if (($numrows - $currenthit) >= $limit ) { $lasthit = $currenthit + ($limit - 1); } else { $lasthit = $numrows; } $selectedPg = sprintf("%.0f", (($currenthit/$limit) + 1)); $j= 1; for ($i=1; $i<=$pages; $i++) { $newoffset = $limit * ($i - 1); if($selectedPg == $i) { $str.= "$i | "; } else { $str.= "$i |"; } $j++; if ($j == 30) { $str.= "
"; $j = 1; } } $str.= " 
"; if($offset!=0) { $cr=$offset-$limit; $str.="Previous"; if ($offset+($offset) >= $numrows) { $str.= "  "; } else { $str.= " | "; } } if($offset<$numrows && (($numrows-$offset)>$limit)) { $str.= "Next"; } $str.= "
"; return $str; } ###### //$var = file type variable //$field_name=Name of the field in which value has to be stored //$tbl_name=Name of the table //newID=ID generated after inserting the record //$field_id = Name of the matching field in the update command #### function upload_image($var, $field_name, $tbl_name,$newID, $field_id) { if (!empty($_FILES[$var]['tmp_name'])) { $upload_image = $_FILES[$var]['tmp_name']; $imagefile_name = $_FILES[$var]['name']; $imagefile_type = $_FILES[$var]['type']; $imagefile_size = $_FILES[$var]['size']; $error=""; if (!empty($upload_image)) { $tname = explode(".",$imagefile_name); $newSmallImage = $var."_".$newID.".".$tname[1]; if(is_uploaded_file($upload_image)) { if(($imagefile_type == "image/gif") || ($imagefile_type == "image/jpeg") || ($imagefile_type == "image/png") || ($imagefile_type == "image/pjpeg") || ($imagefile_type == "image/bmp")) { if(!is_dir("images/".$var)) { mkdir("images/".$var,777); } $upfile = "images/".$var."/".$newSmallImage; //echo umask(0000); copy($upload_image,$upfile); } else { $newSmallImage = ""; } } else { $newSmallImage = ""; } } else { $newSmallImage = ""; } } else { $newSmallImage = ""; } $update_sql="update ".$tbl_name." set `".$field_name."` = '".$newSmallImage."' where ".$field_id." = '".$newID."'"; mysql_query($update_sql); } function GetBanner() { $sql="select fld_id from tbl_banners where fld_bannerImpressions <= fld_maxImpressions "; if(isset($_REQUEST['county'])) $sql.= " AND fld_county_id = '".$_REQUEST['county']."'"; if(isset($_REQUEST['category'])) $sql.= " AND fld_category_id = '".$_REQUEST['category']."'"; $res = mysql_query($sql); if(!$res) echo mysql_error(); $intNumBanners = mysql_num_rows($res); $intRandom = rand(1,$intNumBanners); if($intNumBanners != 0) { $i=1; while($row = mysql_fetch_array($res)) $banner[$i++]=$row[0]; $sql1 = "select * from tbl_banners where fld_id= '".$banner[$intRandom]."'"; $res1 = mysql_query($sql1); //ho $sql1; if(!$res1) echo mysql_error(); $row1 = mysql_fetch_array($res1); echo "
";
 print_r($row1);
 $path = BANNER_PATH;

  if(substr($row1['bannerImage'],0,7)!="http://")
    {
 $strBanner_VirtualPath = "admin/banners/";
 $strBannerHTML = "".$row1[";
    }
  else 
   {
   $strBannerHTML = "".$row1[";
   }  
// echo htmlentities($strBannerHTML);
echo $strBannerHTML;
 
 $sql2 = "UPDATE tbl_banners SET fld_bannerImpressions = fld_bannerImpressions + 1 WHERE fld_id = ".$row1['bannerId'];
 $res2 = mysql_query($sql2);
}
 }






?>Database error: pconnect(localhost, , $Password) failed.
MySQL Error: ()
Session halted.