Ejemplo n.º 1
0
/**********************************************************************
 *  ezSQL initialisation for mySQL
 */
// Include ezSQL core
include_once "../shared/ez_sql_core.php";
// Include ezSQL database specific component
include_once "ez_sql_mysql.php";
// Initialise database object and establish a connection
// at the same time - db_user / db_password / db_name / db_host
$db = new ezSQL_mysql('db_user', 'db_password', 'db_name', 'db_host');
/**********************************************************************
 *  ezSQL demo for mySQL database
 */
// Demo of getting a single variable from the db
// (and using abstracted function sysdate)
$current_time = $db->get_var("SELECT " . $db->sysdate());
print "ezSQL demo for mySQL database run @ {$current_time}";
// Print out last query and results..
$db->debug();
// Get list of tables from current database..
$my_tables = $db->get_results("SHOW TABLES", ARRAY_N);
// Print out last query and results..
$db->debug();
// Loop through each row of results..
foreach ($my_tables as $table) {
    // Get results of DESC table..
    $db->get_results("DESC {$table['0']}");
    // Print out last query and results..
    $db->debug();
}
Ejemplo n.º 2
0
<?php

// ezSQL
require_once 'libs/ez_sql_core.php';
require_once 'libs/ez_sql_mysql.php';
// Zebra Pagination
require_once 'libs/Zebra_Pagination.php';
$conn = new ezSQL_mysql('root', '', 'jvs_tutoriales');
$total_paises = $conn->get_var('SELECT count(*) FROM paises');
$resultados = 6;
$paginacion = new Zebra_Pagination();
$paginacion->records($total_paises);
$paginacion->records_per_page($resultados);
// Quitar ceros en numeros con 1 digito en paginacion
$paginacion->padding(false);
$paises = $conn->get_results('SELECT * FROM paises LIMIT ' . ($paginacion->get_page() - 1) * $resultados . ', ' . $resultados);
?>
<!DOCTYPE html>
<html lang="es">
	<head>
		<meta charset="utf-8">
		<title>JV Software | Tutorial 14</title>
		<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
		<style>
			.mostrar-mas {
				text-align: center;
				background-color: #D9EDF7;
				border: 1px solid #BCE8F1;
			}
			.mostrar-mas a {
Ejemplo n.º 3
0
        exit;
    }
    if ('' == $game) {
        $game = "兵锋王座";
    }
    if ('' == $room) {
        $room = "兵者之心";
    }
    $result["ret"] = "0";
    $result["game"] = $game;
    $result["room"] = $room;
    $result["value"] = $value;
    $codes = array();
    for ($i = 0; $i < $amount; $i++) {
        $code = genCode();
        $var = $db->get_var("SELECT count(*) FROM goldcode where code='{$code}'");
        if (0 == $var) {
            $codes[$i] = $code;
            $db->query("INSERT INTO goldcode (code,value,game,room) VALUES ('{$code}','{$value}','{$game}','{$room}')");
        } else {
            $i--;
        }
    }
    $result["codes"] = $codes;
} else {
    if ($act = "usecode") {
        $row = $db->get_row("SELECT `code`,`value` FROM goldcode where " . " `code`='{$code}' and `valid`=1 and `game`='{$game}' and `room`='{$room}'");
        if (null != $row) {
            $result["ret"] = "0";
            $result["game"] = $game;
            $result["room"] = $room;
Ejemplo n.º 4
0
           
          <div class="table-responsive">
            <table class="table table-striped table-hover table-bordered">
              <thead>
                <tr class="danger" >
                  <th style="width: 25%;" >ficha</th>
                  <th style="width: 25%;">cursos</th>
                  <th style="width: 25%;">Descripción</th>                 
                  <th style="width: 5%;">Editar</th>
                  <th style="width: 5%;">Eliminar</th>
                </tr>
              </thead>
              <tbody >
              <?php 
$conn = new ezSQL_mysql(DB_USER, DB_PASS, DB_NAME);
$total_cursos = $conn->get_var('SELECT count(*) FROM cursos');
$resultados = 10;
$paginacion = new Zebra_Pagination();
$paginacion->records($total_cursos);
$paginacion->records_per_page($resultados);
// Quitar ceros en numeros con 1 digito en paginacion
$paginacion->padding(false);
$lista_cursos = $conn->get_results('SELECT * FROM cursos LIMIT ' . ($paginacion->get_page() - 1) * $resultados . ', ' . $resultados);
foreach ($lista_cursos as $cursos) {
    echo '<tr >
                  			<td>' . $cursos->ficha . '</td>
                 		 	  <td>' . $cursos->nombre . '</td>
                 		 	  <td>' . $cursos->descripcion . '</td>
                 		 	
                  		 	
                 		 	<td><a href="?view=cursos&mode=edit&id_curso=' . $cursos->id_curso . '" class="btn btn-success"><span class="glyphicon glyphicon-pencil"></span></a>  </td> 
Ejemplo n.º 5
0
/* * ********************************************************************
 *  ezSQL initialisation for mySQL
 */
// Include ezSQL core
include_once "../../../db.php";
include_once "../shared/ez_sql_core.php";
// Include ezSQL database specific component
include_once "ez_sql_mysql.php";
// Initialise database object and establish a connection
// at the same time - db_user / db_password / db_name / db_host
$SKTDB = new ezSQL_mysql(DB_USER, DB_PASSWORD, DB_NAME, DB_SERVER);
/* * ********************************************************************
 *  ezSQL demo for mySQL database
 */
// Demo of getting a single variable from the db
// (and using abstracted function sysdate)
$current_time = $SKTDB->get_var("SELECT " . $SKTDB->sysdate());
print "ezSQL demo for mySQL database run @ {$current_time}";
// Print out last query and results..
$SKTDB->debug();
// Get list of tables from current database..
$my_tables = $SKTDB->get_results("SHOW TABLES", ARRAY_N);
// Print out last query and results..
$SKTDB->debug();
// Loop through each row of results..
foreach ($my_tables as $table) {
    // Get results of DESC table..
    $SKTDB->get_results("DESC {$table['0']}");
    // Print out last query and results..
    $SKTDB->debug();
}
Ejemplo n.º 6
0
            <table class="table table-striped table-hover table-bordered">
              <thead>
                <tr class="danger" >
                  <th style="width: 25%;" >Nombres</th>
                  <th style="width: 25%;">Apellidos</th>
                  <th style="width: 5%;">Email</th>
                  <th style="width: 10%;">Celular</th>
                  <th style="width: 5%;">Dirección</th>
                  <th style="width: 5%;">Editar</th>
                  <th style="width: 5%;">Eliminar</th>
                </tr>
              </thead>
              <tbody >
              <?php 
$conn = new ezSQL_mysql(DB_USER, DB_PASS, DB_NAME);
$total_usuarios = $conn->get_var('SELECT count(*) FROM user');
$resultados = 10;
$paginacion = new Zebra_Pagination();
$paginacion->records($total_usuarios);
$paginacion->records_per_page($resultados);
// Quitar ceros en numeros con 1 digito en paginacion
$paginacion->padding(false);
$usuarios = $conn->get_results('SELECT * FROM user LIMIT ' . ($paginacion->get_page() - 1) * $resultados . ', ' . $resultados);
foreach ($usuarios as $users) {
    echo ' 	<tr >
                  			<td>' . $users->names . '</td>
                 		 	<td>' . $users->last_names . '</td>
                 		 	<td>' . $users->email . '</td>
                 		 	<td>' . $users->cel_phone . '</td> 
                 		 	<td>' . $users->address . '</td>