I'm trying to make an app in which the clients bring me the data. The app is made in html, phonegap, and I want to try to understand a bit ajax to be able, through it, to bring the data of my php.
<?php
try {
$conn = new PDO("mysql:host=$servername;dbname=prueba", "root", "");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
$stmt = $conn->prepare('SELECT * FROM clientes');
$stmt->execute();
while ($row = $stmt->fetch()){
echo "Clientes: ".$row['nombre'];
}
?>
This php is hosted in a domain and I wanted to bring that data from there. I also read JSON, but I would like you to give me some guidance and learn a little more ... thanks