vendredi 15 juillet 2016
postgres stored procedure json error
So I'm making a application where I want a json string to display(for now). I call a stored procedure with php(which works) and that stored procedure returns a row.
The problem is that the record/row that is returned has to be a json string. For that I use php:
$verbinding = pg_connect("host=**** port=**** dbname=*** user=******* password=****");
$query = 'SELECT to_json(function_name(parameter))';
$contests = pg_query($query);
if(json_decode($contests)) {
echo 'succeeded';
} else {
echo 'failed';
}
Now my code always returns failed and I don't know why or how can I fix this. Thank you in advance for your help!
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire