RE: Converting from ASP to PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Duane Lakoduk [mailto:dlakoduk@mn.rr.com] 
> Sent: Monday, February 02, 2004 3:27 PM
> 
> I have been developing ASP sites and applications for about 7 years.
> Recently, I have been considering doing some of my new 
> development projects in PHP.  Depending on the learning curve, I
> will have to support and continue ASP for some time.  I know there
> a lots of resources available for PHP and I have a few of the
> recommeded books, documentation, etc.

I think you'll find the learning curve quite easy.  I went from ASP and
various other scripting languages as a background, to PHP and I'm
constantly amazed at the flexibility and functionality of PHP.  Every
time I think "God, I'm goinna have to create a function to do such and
such", PHP usually already has something built into it.  A great relief.
I'm just used to having to manually create a lot of basic functions like
I used to do in ASP.

> My environment is Windows 2000 AS, IIS 5.0 and SQL Server 
> 2000. Support is for I.E. 5.5+.
> 
> I need to be able to perform programming tasks like:
> 
> - LDAP queries against Exchange 5.5 database
> - Remote Scripting (Microsoft - MSRS)
> - Typical database SELECTS, INSERTS, UPDATES, DELETES and 
> execute Stored
> Procedures
> 
> I have not seen any examples of performing LDAP queries or 
> remote scripting. I know there are many examples of database access.

http://www.php.net/manual/en/ref.ldap.php

I started to play with this one day, but the LDAP extension for PHP was
giving me some issues (some silly configuration issue probably) so I
left it alone.  I'll go back to it eventually.

I havn't looked into MSRS, personally.. So can't really tell you much as
far as using PHP with it, but there's most likely some way to do it.
PHP's pretty flexible.

As for databases and stored procedures, you can either use PHP's built
in MS Sql, Oracle, ODBC, MySQL, etc database functions or you can use a
script like PHPEverwhere's "ADODB" script (http://php.weblogs.com/adodb)
to make portable database code that you can use on just about any
database just by changing the connect string.

Since I work with MS Sql and Oracle, I find this to be pretty useful.
Don't have to change my way of thinking of or coding, just do the same
stuff for all the DBs I access.

> I am interesting in hearing from anyone who also made the 
> switch to PHP. What problems or challenges were met, what
> limitations or advantages were discovered.  If any of the
> above (LDAP or MSRS) were particularly troublesome in
> conversion or development in PHP.

No real problems or challenges in learning PHP itself, it's really
straightforward if you ask me.  You always learn new little tricks as
you go along, but I found it much easier to learn than ASP.

The database stuff was a little interesting, but there are some good
examples online and once you find a method that works for what you want,
then you can just keep using the same technique.  Just a matter of
copy/paste or making a standard database access scheme.

Like I have a "dbconnect.inc" file in a shared includes folder that all
my scripts hit. I set $database="DatabaseIdentifier" then I have a
"switch" statement that dynamically sets the connection string.

>From there, the "dbconnect.inc" processes a variable called $sqlquery
that contains the SELECT, INSERT or DELETE string.  The default result
set for ADODB is "$arr", so in my main script I just do a "if
(count($arr) > 0)" then do the good stuff, " } else { " Do what you need
to do if no data is returned from query.

I handle updates and inserts slightly different than select statements,
but that's the essential gist.

Once I set up a connection string for each DB, I just write a script
assigning a $database= and an $sqlquery= and then process $arr after I
include the dbconnect.inc file.

If someone has a better way, I'm always happy to listen, but it seems to
work pretty good for me and provide me with the flexibility and
modularity that I need.

Like I said about LDAP, the extension choked on me, but I havn't taken
the time to diagnose the issue.

Good luck!  Report back with your trials and tribulations, I'd be
curious to hear more about the LDAP and MSRS functionality with PHP.

-TG

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux