PHP and Mysql (L5)

zed

Member
Dec 28, 2007
5,703
6
0
34
in bootsector
he he. back in action with some practicle stuff. nothing much. just a intro for Syntax (grammer in programing)
so just go true it:rofl::rofl::rofl::rofl::rofl::rofl::rofl:





Basic Syntax


As stated in introduction, PHP is an HTML-embedded scripting language. This means that you can intermingle PHP and HTML code within the same file. So to begin programming with PHP, start with a simple Web page. Script 1.1 gives an example of a no-frills, no content XHTML Transitional document, which will be used as the foundation for every Web page in the book (this book does not formally discuss [X ]HTML;see a resource dedicated to the topic for more information).

To add PHP code to a page, place it within PHP tags:

<?php
?>

Anything placed within these tags will be treated by the Web server as PHP (meaning the PHP interpreter will process the code). Any text outside of the PHP tags is immediately sent to the Web browser as regular HTML. Along with placing PHP code within PHP tags, your PHP files must have a proper extension. The extension tells the server to treat the script in a special way, namely, as a PHP page. Most Web servers will use .htmlor .htmfor standard HTML pages, and normally, .phpis preferred for your PHP files.


To make a basic PHP script:

1. Create a new document in your text editor or Integrated Development Environment (Script 1.2). It generally does not matter what application you use, be it Dreamweaver (a fancy IDE), BBEdit (a great and popular Macintosh plain-text editor), or VI (a plaintext UNIX editor, lacking a graphical interface). Still, some text editors and



ekphptz9.jpg




This PHP script doesn’t do anything, does demonstrate how a PHP script is written. It’ll also be used as a test, prior to getting into elaborate PHP code.