I have a strange question. I need to send some code to a client without having access to the server to test my code. In addition, it's using postgreSQL which I've never used, and I've not done PHP for a while!
In order to save some time, I'd really appreciate if someone could tell me if this code will do what I want?
example feed
<?
$sql = "SELECT * FROM V_SIDE_MENU_E";
include 'db.inc.php';
?>
db.inc.php
$connectString = 'host=localhost dbname=myDatabase user=foo password=bar';
$link = pg_connect($connectString);
if (!$link) {
echo "error";
} else {
$result = pg_query($link, $sql);
$rows = array();
while($r = pg_fetch_assoc($result)) {
$rows[] = $r;
}
print json_encode($rows);
}