(Sorry for my bad English , it's not my mother tongue)
Ok so i want to extract datas from my Symfony DataBase (on Mysql) by using a JSON Script
here is the JSON script (connexion.php) for per example my DB : tblville
<?php $con = mysqli_connect("localhost","root","","tblville");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result= mysqli_query($con,"SELECT * FROM tblville");
while($row=mysqli_fetch_assoc($result))
$output[]=$row;
print(json_encode($output));
mysqli_close($con);
?>
The result : Data extracted using JSON on Table tblville
now i want to extract data from my db symfony using the same code :
<?php
$con = mysqli_connect("localhost","root","","symfony");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result= mysqli_query($con,"SELECT * FROM patients");
while($row=mysqli_fetch_assoc($result))
$output[]=$row;
print(json_encode($output));
mysqli_close($con);
?>
it doesn't work : JSON Script on Symfony
even if i change "localhost" by "127.0.0.1"
My paramater.yml code
parameters:
database_host: 127.0.0.1
database_port: null
database_name: symfony
database_user: root
database_password: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
secret: 1c9da92ddf2bff0482bf213b8f1cff6752c8b2b0
Need help , thanks