[OpenLayers-Users] PHP/postgreSQL tab delimited text issues.

MATTHEW J PURDY mpurdy at wisc.edu
Fri Apr 20 14:06:03 EDT 2007


Hey, 
I'm trying to dynamically load points/markers using php and the openLayer.text method. 

I'm having trouble getting anything to display, and I think it might be aformatting thing. 

does anybody have an example of this? here is what I'm doing 

the php.
:

<?php

header('Content-Type: text/plain');

echo "point    title    description    icon\n";
$db_conn = pg_connect ("host=xxxxxx port=xxxxx dbname=xxxx user=xxxxxx password=xxxxxx");

$qu = pg_exec ($db_conn, "SELECT xxxxx.* from xxxx order by xxxxx.row_id asc;");

while ($data = pg_fetch_object ($qu)) {
srand((double)microtime()*1000000);
$value = (rand(0,100)*.95);
$num = $data->short_name;
$x = $data->fixed_latitude;
$y = $data->fixed_longitude;
$measuring = 'water_level';

echo "$x,-$y   $num   <span class='loc'>Location: $data->long_name</span><br/><span class='meas'>Measurement: $measuring</span><br/><span class='val'>Value: $value</span><br/><span class='t'>Time:12:00:00</span><br/>   icon_buoy.gif\n";

}
?>

implemented here in the html.
var newl = new OpenLayers.Layer.Text( "Water", {location: "ol2.php"} );
            newl.setVisibility(false);
		map.addLayer(newl);

thanks.



More information about the Users mailing list