Category Archive : General

Before understanding the embedded PHP we have to know that we can write our complete web applications in standalone PHP, but in most cases, PHP is embedded in HTML or XML file. Before Knowing Just because PHP is a scripting language & is used for making the page dynamic and process Logical tasks.

A source file can contain numerous lines of codes including PHP or non-PHP style. Working with PHP is quite different from HTML because the clients are unable to download the source code in PHP. Do you know that what happens when a user requests a PHP page? -The code in the requested file is processed by the server then it displays you the result in HTML form.

The main aim of working with PHP is to use the processing powers of the server to build the dynamic web pages. This means that if you click “view source” on a PHP page, you are not able to see the PHP codes you will see only HTML tags. Due to this, you cannot see how a PHP page is made and what logic is used to process the page with the help of “view source”.

Example PHP code

<?php  
            echo "Hello world using echo </br>";  
            ECHO "Hello world using ECHO </br>";  
            EcHo "Hello world using EcHo </br>";  
        ?>  

Embedding PHP in HTML

Have a look on given example :

<?php  
Echo "<html>"; 
Echo "<title>HTML with PHP</title>"; 
Echo "<b>ExpertPHP Example</b>";  
//your php code goes here   
?>

As i told you that you can even embed php code within HTML Tags too, please have a look on given example.

<html>
<head>
<title>Embed PHP within HTML tags</title>
</head>
<body>
Put here your HTML code
<?php 
    
        // php code goes here
?>
Back into normal HTML
</body>
</html>

You can also put your html code within specific conditions of PHP.

<?php if(your condition) { ?>
... PUT HTML CODE ...
<?php } ?>

Transact-SQL statements can refer to GETDATE anywhere they can refer to a datetime expression.

GETDATE is a nondeterministic function. Views and expressions that reference this function in a column cannot be indexed.

Using SWITCHOFFSET with the function GETDATE() can cause the query to run slowly because the query optimizer is unable to obtain accurate cardinality estimates for the GETDATE value. We recommend that you precompute the GETDATE value and then specify that value in the query as shown in the following example. In addition, use the OPTION (RECOMPILE) query hint to force the query optimizer to recompile a query plan the next time the same query is executed. The optimizer will then have accurate cardinality estimates for GETDATE() and will produce a more efficient query plan.

SELECT RIGHT(YEAR(Creation_Date), 2) YY FROM Table_Name

Result

| YY |
------
| 10 |
| 11 |
| 13 |