コード例 #1
0
ファイル: conection.php プロジェクト: sirlux/Vizualizacija
 /**
  * Returns a PDO instance -- a connection to the database.
  * The singleton instance assures that there is only one connection active
  * at once (within the scope of one HTTP request)
  *
  * @return PDO instance
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         $config = "mysql:host=" . self::$host . ";dbname=" . self::$schema;
         $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_PERSISTENT => true, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
         self::$instance = new PDO($config, self::$user, self::$password, $options);
     }
     return self::$instance;
 }
コード例 #2
0
 function __construct()
 {
     parent::__construct();
     $this->createtableTurma();
 }
コード例 #3
0
ファイル: eliminar.php プロジェクト: edisonosorioj/Portafolio
<?php

require_once "../conection.php";
$conex = new conection();
$result = $conex->conex();
$id = $_GET['id'];
$query = mysqli_query($result, "delete from contactos where id='{$id}'");
?>

<html>
	<head>
		<title>Contactos</title>
		<meta charset="UTF-8" />
		<link rel='stylesheet' href='../css/reset.css' />
		<link rel='stylesheet' href='../css/estilos.css' />
	</head>
	
	<body>
		<center>
			<?php 
if ($query > 0) {
    ?>
				
				<h1>Contacto Eliminado</h1>
				
				<?php 
} else {
    ?>
				
				<h1>Error al Eliminar Contacto</h1>
				
コード例 #4
0
ファイル: db.php プロジェクト: sirlux/Vizualizacija
 public static function sklenitvezvez2015($min, $max)
 {
     $db = conection::getInstance();
     $db->exec("set names utf8");
     $query = "SELECT * FROM celotna WHERE `skupno2015` > :min AND `skupno2015`<:max ORDER BY `sklenitvezvez2015` DESC ";
     $stmt = $db->prepare($query);
     $stmt->bindParam(":min", $min);
     $stmt->bindParam(":max", $max);
     $stmt->execute();
     $result = $stmt->fetchAll();
     $rows = array();
     foreach ($result as $row) {
         $rows[] = $row;
     }
     echo json_encode($rows);
 }
コード例 #5
0
<?php

class conection
{
    function conex()
    {
        $dbserver = "52.25.205.86:3306";
        // $dbserver = "127.0.0.1";
        // $dbserver = "localhost";
        $dbuser = "******";
        $password = "******";
        // $password = "";
        $dbname = "cocorrico";
        $conex = new mysqli($dbserver, $dbuser, $password, $dbname);
        if ($conex->connect_errno) {
            echo "Errno: " . $conex->connect_errno . "\n";
            echo "Error: " . $conex->connect_error . "\n";
            die("No se pudo conectar a la base de datos");
        }
        return $conex;
    }
}
$conn = new conection();
$conn->conex();
コード例 #6
0
 function __construct()
 {
     parent::__construct();
     $this->createtableAluno();
 }