Files
unisa_tsw_2014_2015/php12_mysql.php

88 lines
1.1 KiB
PHP

<?php
require_once ('functions.php');
include('header.html');
///////////////////////////
echo<<<_css
<style>
input:valid {
background-color:green;
}
input:invalid {
background-color:red;
}
input:in-range {
font-size:20pt;
}
input:required {
color:red;
}
input:optional {
color:blue;
}
input:active {
outline: 5px black solid;
}
input:focus {
outline: 5px yellow solid;
}
#a[placeholder="mario"][required]{
outline: 5px red solid;
}
</style>
_css;
echo "\n";
///////////////////////////
$db = new PDO ("mysql:host=localhost;dbname=phptest","root","alfiobello",array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
//$db->query("INSERT INTO persone VALUES('mario','gino','2')");
try{
$statement = $db->prepare("INSERT INTO persone VALUES(:a,:b,:c)");
$statement->execute(array("a"=>"alfio","b"=>"giulio","c"=>"45"));
}
catch (Exception $e){}
$statement = $db->prepare("SELECT * FROM persone p where p.eta > 1");
$statement->execute();
while ($row = $statement->fetch())
foreach($row as $key => $value)
echo $value," \n<br>";
include ('footer.html');
?>