[mapserver-users] Sorta Off Topic - Putting PHP code in a CGI script?

Antti.Roppola at brs.gov.au Antti.Roppola at brs.gov.au
Thu Feb 28 18:20:01 EST 2002


You'd be better off calling your code from inside PHP
if you really needed it. PHP is usually set up as a
module in your server, so it's probably going to be
respond faster than a CGI.

As for the database, you could excise the CGI specifics
in your database and call them from inside PHP as functions.
Later on, you could re-write each function as native PHP.
I do this to keep all database specific stuff out of my apps:

function select_old ($sql) {
	system(myoldcgoappmodified "$sql");
	... stuff happens...
	return $result;
}

function select($sql, $link) {
	if (!($result = mysql_query($sql,$link))) {
		echo("SQL query failed: $sql from $link<BR>\n");
	}
	return $result;
}

Antti

-----Original Message-----
From: Tyler Mitchell [mailto:TMitchell at lignum.com]
Sent: Friday, 1 March 2002 8:10 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] Sorta Off Topic - Putting PHP code in a CGI
script?


Hi guys, I'm new to both CGI and PHP, but saw an example somewhere in a CGI
script that allowed you to enter in raw HTML instead of putting in a
separate PRINT command for it.  I cannot, for the life of me, find this
example again though.  I though it would allow me to easy put in PHP stuff
into my CGI script.
I thought it went something like this:

.......
$query->start_html;
print "bleh bleh";
ECHO END >>>>
<B>This is bold</B>
<? PHP script stuff ?>
END <<<<
$query->end_html;

Know what I mean?  I don't know what you call this and have searched and
searched the docs with no avail :(





More information about the mapserver-users mailing list