Created
February 5, 2020 10:36
-
-
Save phpfiddle/c8d12e1310c7d322581a6da1ba63605f to your computer and use it in GitHub Desktop.
[ Posted by Rosario Camaggio ] provaconnegit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>PHP pdo</title> | |
</head> | |
<body> | |
<?php | |
$user = 'KBFD9iLsqO'; | |
$password = 'hpZrTdZJCp'; | |
$db = 'KBFD9iLsqO'; | |
$host = 'remotemysql.com'; | |
$port = 3306; | |
$conn = new PDO("mysql:host=$host; dbname=$db; port=$port", $user, $password); | |
$result = []; | |
$stmt = $conn->query("SELECT * FROM usertab"); | |
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ | |
$result[] = $row; | |
} | |
echo json_encode($result); | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment