-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannonceshow.php
48 lines (35 loc) · 974 Bytes
/
annonceshow.php
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
37
38
39
40
41
42
43
44
45
46
47
<?php
$databaseHost = 'localhost';
$databaseName = 'ecosmart2';
$databaseUsername = 'root';
$databasePassword = '';
$conn = new PDO("mysql:host=$databaseHost;dbname=$databaseName",$databaseUsername, $databasePassword);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "select * from annonce";
$stmt = $conn->prepare($sql);
$stmt->execute();
echo json_encode($stmt->fetchAll());
?>
<?php
/*
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "pas de conn";
}
else echo "good";
$sql = "INSERT INTO login(username,password)
VALUES("+$_GET["test"]+","+$_GET["mdp"]+")";
if ($conn->query($sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();*/
?>