Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id_Control Primaria Índice int(10)
- idctg_turno Índice int(10)
- total_horas int(10)
- horas_normales int(10)
- horas_extras int(10)
- Incidencia varchar(1000)
- semana int(10)
- <?php
- if($action == 'ajax'){
- // escaping, additionally removing everything that could be (html/javascript-) code
- $q = mysqli_real_escape_string($con,(strip_tags($_REQUEST['q'], ENT_QUOTES)));
- $aColumns = array('semana');//Columnas de busqueda
- $sTable = "calculos";
- $sWhere = "";
- if ( $_GET['q'] != "" )
- {
- $sWhere = "WHERE (";
- for ( $i=0 ; $i<count($aColumns) ; $i++ )
- {
- $sWhere .= $aColumns[$i]." LIKE '".$q."' OR ";
- }
- $sWhere = substr_replace( $sWhere, "", -3 );
- $sWhere .= ')';
- }
- $sWhere.=" order by semana ASC";
- include 'pagination.php'; //include pagination file
- //pagination variables
- $page = (isset($_REQUEST['page']) && !empty($_REQUEST['page']))?$_REQUEST['page']:1;
- $per_page = 10; //how much records you want to show
- $adjacents = 4; //gap between pages after number of adjacents
- $offset = ($page - 1) * $per_page;
- //Count the total number of row in your table*/
- $count_query = mysqli_query($con, "SELECT count(*) AS numrows FROM $sTable $sWhere");
- $row= mysqli_fetch_array($count_query);
- $numrows = $row['numrows'];
- $total_pages = ceil($numrows/$per_page);
- $reload = './calculos.php';
- //main query to fetch the data
- $sql="SELECT * FROM $sTable $sWhere LIMIT $offset,$per_page";
- $query = mysqli_query($con, $sql);
- //loop through fetched data
- if ($numrows>0){
- ?>
Add Comment
Please, Sign In to add comment