On Tue, 14 Nov 2000, Sandeep wrote:
> PHP seems to do the same thing which a Webserver written in
> Delphi does i.e. replacing tags with supplied text. And then the
> web server must support php. How does it make it better than any
well, it does a bit more that just "replace tags with supplied text",
which is doesn't... heres some wee example code:
<?php
/* Example PHP */
/* Open a PostgreSQL database connection */
$conn = pg_Connect("dbname=testdb username=mark");
if (!$conn)
{
echo "Database connection failed.";
exit;
}
/* Retrieve all records */
$result = pg_Exec($conn, "SELECT * FROM some_table");
$numitems = pg_NumRows($result);
if ($numitmes == 0)
{
echo "No results.";
}
$i = 0;
while ($i < $numitems)
{
$field1 = pg_Result($result, $i, "field1");
$field2 = pg_Result($result, $i, "field2");
echo "$field1 - $field2";
$i++
}
?>
This is very simple, but functional.
> other scripting language. Isn't it another language trying to make
How does it make it better? It doesn't, personally, Python is fastly
becoming one of the best scripting languages I've used, perl is great, but
allows you to easily make messy code. Yeh PHP is another language, but if
you webserver supports CGI, it can support PHP, it just runs the boat load
faster if you use mod_php under apache.
And just to show I'm not biased tooo much, I also use Perl under NT to
access my SQLServer 7 databases, it's no more "messy" for accessing the
database either, although with ADO you do get that abstracted db layer:
#!/this/is/windows/perl
use OLE;
use Win32API::Registry 0.13 qw( :ALL );
RegOpenKeyEx ( HKEY_CURRENT_USER, "Software\MyApp\Databases", 0, \
KEY_READ, $key);
RegQueryValueEx ( $key, 'MySQL7DB', [], $type, $currentdb, []);
RegCloseKey( $key );
$conn = CreateObject OLE "ADODB.Connection";
$conn->open($currentdb);
$rs = $conn->execute("select * from some_table");
$field1 = $rs->Fields("field1")->value;
print $field1;
> life more complicated. Why can't we have a universal language to
> do everything we like?
Because theres not one universal language that does everything we like,
and if there was, it would certainly not do it all nicely. Would you
rather do complex math with fortran or perl?
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"