Can't connect to $dbhost as $dbuser"; echo "

mysql Error: ", mysql_error(); } else { echo "

Database error encountered

"; } if ($DB_DIE_ON_FAIL) { echo "

This script cannot continue, terminating."; die(); } } if (! mysql_select_db($dbname)) { if ($DB_DEBUG) { echo "

Can't select database $dbname

"; echo "

mysql Error: ", "Greska"; } else { echo "

Database error encountered

"; } if ($DB_DIE_ON_FAIL) { echo "

This script cannot continue, terminating."; die(); } } mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER utf8"); mysql_query("SET COLLATION_CONNECTION='utf8'"); return $dbh; } function db_disconnect() { mysql_close(); } function db_query($query, $debug=false, $die_on_debug=true, $silent=false) { global $DB_DIE_ON_FAIL, $DB_DEBUG; if ($debug) { echo "

" . htmlspecialchars($query) . "
"; if ($die_on_debug) die; } $qid = mysql_query($query); if (! $qid && ! $silent) { if ($DB_DEBUG) { echo "

Can't execute query

"; echo "
" . htmlspecialchars($query) . "
"; echo "

mysql Error: ", mysql_error(); } else { echo "

Database error encountered

"; } if ($DB_DIE_ON_FAIL) { echo "

This script cannot continue, terminating."; die(); } } return $qid; } function db_fetch_array($qid) { return mysql_fetch_array($qid); } function db_fetch_row($qid) { return mysql_fetch_row($qid); } function db_fetch_assoc($qid) { return mysql_fetch_assoc($qid); } function db_fetch_object($qid) { return mysql_fetch_object($qid); } function db_num_rows($qid) { return mysql_num_rows($qid); } function db_affected_rows() { return mysql_affected_rows(); } function db_insert_id() { return mysql_insert_id(); } function db_free_result($qid) { mysql_free_result($qid); } function db_num_fields($qid) { return mysql_num_fields($qid); } function db_field_name($qid, $fieldno) { return mysql_field_name($qid, $fieldno); } function db_data_seek($qid, $row) { if (db_num_rows($qid)) { return mysql_data_seek($qid, $row); } } class Paging { var $int_num_result; // Number of result to show per page var $int_nbr_row; // Total number of items (generally a sql count from db) var $int_cur_position; // Current position in recordset var $str_table_bgcolor; // Color of the html table contour, default to black var $str_table_width; // Width of the HTML table, default to 400 pixel var $img_source_next = "\"Previous\""; var $img_source_previous = "\"Next\""; // ------------------------------------------------------------------------------------------ Constructor // function Paging( $int_nbr_row, $int_cur_position, $int_num_result, $str_table_bgcolor = "#000000", $str_table_width = 400 ){ $this->int_nbr_row = $int_nbr_row; $this->int_num_result = $int_num_result; $this->int_cur_position = $int_cur_position; $this->str_table_bgcolor = $str_table_bgcolor; $this->str_table_width = $str_table_width; } // ------------------------------------------------------------------------------------------ getNumberOfPage() function getNumberOfPage(){ $int_nbr_page = ceil($this->int_nbr_row / $this->int_num_result); return $int_nbr_page; } // ------------------------------------------------------------------------------------------ getCurrentPage() // T function getCurrentPage(){ $int_cur_page = ceil(( $this->int_cur_position * $this->getNumberOfPage() ) / $this->int_nbr_row); return $int_cur_page; } // --------------------------------------------------------------------------------------------------- openTable() function openTable(){ global $CFG; $ret = "str_table_width ."\">\n\n
str_table_bgcolor ."\">" ."\n\n"; return $ret; } // --------------------------------------------------------------------------------------------------- closeTable() function closeTable(){ $ret = "
"; return $ret; } // end function // -------------------------------------------------------------------------------------------------- printPaging() function printPaging(){ global $PHP_SELF, $CFG; // Open the html table print $this->openTable(); print "tablzag\" valign=top>· Listing ". ( $this->int_cur_position + 1 ); print " - "; if( $this->int_cur_position + $this->int_num_result >= $this->int_nbr_row ){ print $this->int_nbr_row; }else{ print ( $this->int_cur_position + $this->int_num_result ); } print " od ". $this->int_nbr_row ."\n"; print "\n"; // Previous link here if ( $this->int_cur_position != 0 ){ print "int_cur_position - $this->int_num_result )."\">\n"; print $this->img_source_previous ."\n"; print " \n"; } for( $i=0; $i<$this->getNumberOfPage(); $i++ ){ $int_new_position = ( $i * $this->int_num_result ); global $SESSION; $krit=$SESSION["krit"]; $md=$SESSION["mode"]; print " ".($i+1).""." \n"; } print " \n"; if( ( $this->int_nbr_row - $this->int_cur_position ) > $this->int_num_result ){ $int_new_position = $this->int_cur_position + $this->int_num_result; print "\n"; print $this->img_source_next ."\n"; } print $this->closeTable(); } }; #********************************************************************************************** #********************************************************************************************** ?>