ASP PHP comparison - ASP-PHP Comparison Motes Notes...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
ASP-PHP Comparison Mote’s Notes 4/20/2011 The native tongue of all commercial databases is SQL. The native tongue of all browsers is HTML. Sadly, the two languages have next to nothing in common. Middle tier applications are programs (aka, scripts) whose primary purpose is to translate back and forth between SQL and HTML. They allow browsers to efficiently communicate with back-end databases. Numerous middle tier translators have been developed over the years. Some are very friendly; some are not. Some hold significant market share; some are gaining market share; some have passed their prime. Some are backed by powerful companies; some are open source. ASP is relatively friendly, holds a large market share and is backed by Microsoft. PHP is relatively friendly, has a growing market share and is backed by the open source community. Virtually everything you can do in ASP can be done in PHP, and vice versa. The following table provides a brief comparison of the two. ASP PHP Translation On/Off <% and %> <?php and ?> Comment Line ' (single quote) // End of Line carriage return ; Variable Name Anything $Anything Replacement Statement Variable=any formula $Variable=any formula; String Delimiter " (double quote) " (double quote) Concatenation & . (period) Typical Functions Len strlen Replace str_replace Trim trim FormatCurrency number_format
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ASP PHP If Statement If condition Then If (condition) block of True statements { Else block of True statements block of False statements } End If Else { block of False statements } Note: The Else clause is optional in ASP and PHP Output to Browser Response.Write("content and tags") Echo("content and tags"); Input from Browser Request.Form("browser_field") $_POST["browser_field"]; Note: $_POST must be capitalized Database Identification myServer="MISSQL" $myServer="MISSQL"; myDatabase="MIS325_msbaz123" $myDatabase=array("Database"=>"mis325_msbaz123"); BackEnd="Provider=SQLOLEDB; Integrated Security=SSPI; Persist Security Info=False; Initial Catalog=" & myDatabase & "; Data Source=" & myServer Note: BackEnd is one long line; not three lines Database Connection Set conn=Server.CreateObject("ADODB.Connection") conn.CommandTimeout=15 conn.ConnectionTimeout=15 conn.Open BackEnd $conn=sqlsrv_connect($myServer, $myDatabase); Database Release conn.Close sqlsrv_close($conn); Set conn=Nothing
Background image of page 2
ASP PHP Recordset Name Recordset and current record use same name Recordset and current record use different names rst is the traditional name $recordset is the traditional recordset name $record is the traditional current record name Recordset Creation sql="any SELECT command" $sql="any SELECT command" Set rst=Server.CreateObject("ADODB.Recordset") rst.Open sql, conn $recordset=sqlsrv_query($conn, $sql); Recordset Release rst.Close sqlsrv_free_stmt($recordset); Set rst=Nothing Resordset Reading rst("db_fieldname") $record["db_fieldname"] Get Next Record
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

ASP PHP comparison - ASP-PHP Comparison Motes Notes...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online