auto-populating multiple boxes... php and pg_fetch_array problem?
| From: | pere roca | Date: | Wed, 05 Dec 2007 10:00:34 +0000 |
| Subject: | auto-populating multiple boxes... php and pg_fetch_array problem? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-265464@lists.php.net to get a copy of this message | ||
hi everybody,
there is a nice tool using jquery/php to populate multiple select boxes out
there : http://remysharp.com/2007/09/18/auto-populate-multiple-select-boxes/
it must be a very stupid question but I’m trying to apply this tool to get
data from postgreSQL, but I always get an empty [] value. It means that the
array $json[] is not filled in the while statement. But the dbase connection
and the query is correct ( I can check applying a echo “data: “.$row[0].”";
and all the data is displayed).
I suppose pg_fetch_array is not used correctly (I have checked also
pg_fetch_object)...but I'm not sure because I'n newbie to jquery and json.
If someone has success connecting to postgresql...
Thanks!
After inserting data....
$postgis_result=pg_query("select * from select_chain where
genus='".strtolower(pg_escape_string(strip_tags($_REQUEST['category'])))."'");
$json = array();
while (is_resource($postgis_result) && $row =
pg_fetch_array($postgis_result)) {
$json[] = '"' . $row->label . '"';
}
echo '[' . implode(',', $json) . ']';
die();
--
View this message in context: http://www.nabble.com/auto-populating-multiple-boxes...-php-and-pg_fetch_array-problem--tf4948560.html#a14168475
Sent from the PHP - General mailing list archive at Nabble.com.