-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinsert.php
More file actions
39 lines (23 loc) · 730 Bytes
/
Copy pathinsert.php
File metadata and controls
39 lines (23 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php print ("Pete è anche bravo una volta all'anno"); ?>
<?php
print ("Pete è anche bravo una volta all'anno");
?>
<?php
/*
* Corso PHP & MYSQL
* Utente: Daniele Mondello
* Web Site: danielemondello.it
* Email:info@danielemondello.it
* Argomento:
* Data: 16/04/14
*/
// Fase 1 - Arrivano i dati dal form
// Fase 2 - Connessione al DB
// Fase 3 - Esegui la query seguente;
$Nome="Roberto";
$Cognome="Bettega";
$Eta="50";
$collegamento = 'mysql:host=localhost;port=8889;dbname=classe';
$db = new PDO($collegamento , 'root', 'root');
$sql = $db->exec("INSERT INTO `classe`.`studenti` (`Id`, `Nome`, `Cognome`, `eta`) VALUES (NULL, '".$Nome."','".$Cognome."','".$Eta."')");
echo "Dato inserito!";