Last active
April 27, 2019 02:40
-
-
Save evilnapsis/72b369f1900ea5a0c2ff3053d5ea740d to your computer and use it in GitHub Desktop.
Convertir datos de la tabla contact en JSON
This file contains 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
<?php | |
/* | |
* Convertir datos de la tabla contact en JSON | |
* Powered by @evilnapsis | |
*/ | |
$con = new mysqli("localhost","root","","contacts"); | |
if($con){ | |
$sql = "select * from contact"; | |
$query = $con->query($sql); | |
$data = array(); | |
while($r = $query->fetch_assoc()){ | |
$data[] = $r; | |
} | |
echo json_encode(array("contactos"=>$data)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment