very,simple,efficient,split,bar,BZ,bar,for,mysql,php

Yavuz 9/1/2016 0

A very simple and efficient split bar the B-Z bar , for mysql and php

PHP
<? 

/*  B-Z  stand for be  Zen */ 
function BZ_splitbar ( $total , $actual ,  $step , $file  )   
{ 
$thebar="" ;  //  the string to be output 
$last  =  $total-   ($total % $step)  ; // the last step 
if( $total >  $step )  {  // i have to do one bar 
     if ( ereg ( "&split" , $file ) )  { // does i have a &split= something ?   
    $anArr  = explode  ( "&" , $file    ); 
      $steptr =   $anArr[count( $anArr)-1] ; 
    $file  = ereg_replace( "&".$steptr , "" ,$file ); } ; // delete it 
if ($actual ==0 ) { $thebar= "." ;}  else { $thebar=  " <a href='$file&split=0'>B</a> " ; } 
  for( $i = $step ; $i < ($total-$step) ; $i  = $step )   
  { if  ($i==$actual )  {$thebar .= "." ;} else { $thebar .= "<a href='$file&split=$i'>z</a> " ; } }   
  if ($actual ==$last  ) {$thebar .= "." ;} else { $thebar .=  "<a href='$file&split=$last'>E</a>" ; 
}} return  $thebar ; } /// done 

/*

-----BEGIN  FRAGMENT 
has it is really used : 

$mysql_result = mysql_query( $query) ;  // original query 
$numRows = mysql_numrows($mysql_result ); 
if ( $split =="" ) 
     { 
     $thebar =   BZ_splitbar (  $numRows   ,0  , 10  , $REQUEST_URI ) ;   
     $theLimit =  "LIMIT 0 , 10  " ; 
     } 
else   
    { 
    $thebar =  BZ_splitbar ( $numRows  , $split  ,10  , $REQUEST_URI ) ; 
    $theLimit =  "LIMIT $split , 10  " ; 
    } 

$query = $query.$theLimit ; 
$mysql_result = mysql_query( $query) ; //  do the query with LIMIT 
-----END FRAGMENT 
/// do you stufff  ...BZ_split will take care of the bad stuff   

///  just   echo $thebar   where you want :))) 

*/ 
 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments