Your SlideShare is downloading. ×
0
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Google Cloud Challenge - PHP - DevFest GDG-Cairo

2,067

Published on

08-11-2013

08-11-2013

Published in: Technology
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
2,067
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
1
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. PHP (Personal Home Page) Eng. Haitham Nabil Projects Manager - Ministry of state for administrative development Co-Founder – Open Egypt
  • 2. Introduction ● Static Pages ● ● HTML CSS Java Script ● ● <!DOCTYPE html> ● <html> ● <body> ● <h1>My first PHP page</h1> ● ● ● <?php ● Dynamic Pages ● PHP echo "Hello World!"; ● ?> ● </body> ● </html>
  • 3. Basics ● <?php ● $color= "RED"; ● function myTest() { – – – – $y=10; echo "Variable color is: " . $color; EcHo "<br>"; ECHO "Variable y is: $y"; ● ● myTest(); ● echo "Variable color is: $COLOR "; ● ● } echo "Variable y is: $y"; ?>
  • 4. Basics ● <?php ● for ($x=0; $x<=10; $x++) { – echo "The number is: $x <br>"; ● } ● $x = 0; ● while ($x <=10){ – – ● ● ?> } If ($x % 2 == 0) { ● echo $x; ● $x++ }
  • 5. Basics ● <?php ● $x = 0; ● while ($x <=10){ – – – ● ● ?> } if ($x % 2 == 0) echo $x . “</br>”; else echo “missed <br/> $x++
  • 6. Forms ● <html> ● <body> ● <form action="welcome.php" method="post"> – – Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> ● <input type="submit"> ● </form> ● <a href=”welcome.php?name=hamada”> Welcome Mido </a> – ● ● </body> ● </html>
  • 7. Forms ● welcome.php ● <html> ● <body> ● ● Welcome <?php echo $_POST["name"]; ?><br> ● Your email address is: <?php echo $_POST["email"]; ?> ● ● </body> ● </html>
  • 8. Forms ● welcome.php ● <html> ● <body> ● ● Welcome <?php echo $_GET["name"]; ?><br> ● Your email address is: <?php echo $_GET["email"]; ?> ● ● </body> ● </html>
  • 9. Forms ● welcome.php ● <html> ● <body> ● ● Welcome <?php echo $_REQUEST["name"]; ?><br> ● Your email address is: <?php echo $_REQUEST["email"]; ?> ● ● </body> ● </html>
  • 10. Arrays ● <?php ● $colors=array("red","green","blue",255,0); ● $arrlength=count($colors); ● for($x=0;$x<$arrlength;$x++) { – – ● ● ?> } echo $colors[$x]; echo "<br>";
  • 11. Arrays ● <?php ● $row=array(0=>”35”, "Peter"=>"35",1=>37, "Ben"=>"37","Joe"=>"43"); ● ● foreach($row as $x=>$x_value) ● { ● echo "Key=" . $x . ", Value=" . $x_value; ● echo "<br>"; ● } ● ?>
  • 12. MySQL Connectivity ● <?php ● $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); mysql_select_db("examples",$dbhandle); – ● ● $result = mysql_query("SELECT id, model,year FROM cars"); ● while ($row = mysql_fetch_array($result)) { – echo "ID:".$row{'id'}." Name:".$row{'model'}."Year: ". $row{'year'}."<br>"; ● ● ● } mysql_close($dbhandle); ?>
  • 13. MySQL Connectivity - PDO ● <?php ● $dbh = new PDO("mysql:host=$hostname;dbname=examples", $username, $password); ● $stmt = $dbh->prepare("SELECT * FROM cars WHERE id = :id”); ● $stmt->bindParam(':id', $_REQUEST['id'], PDO::PARAM_INT); ● $result = $stmt->fetchAll(); ● foreach($result as $row) { – echo "ID:".$row{'id'}." Name:".$row{'model'}."Year: ". $row{'year'}."<br>"; ● ● ● } $dbh = null; ?>
  • 14. Sessions and Cookies ● <?php ● ● session_start(); <?php ● $_SESSION['views']=1; ● ● ?> ● $expire=time() +60*60*24*30; setcookie("views", 1, $expire); ● ● ● ● ● ● ● ?> <html> ● <html> <body> ● <body> Pageviews ● Pageviews <?= $_SESSION['views'] ?> ● <?= $_COOKIE['views'] ?> </body> ● </body> </html> ● </html>
  • 15. Sessions and Cookies ● <?php ● session_start(); ● if(isset($_SESSION['views'])) unset($_SESSION['views']); session_destroy(); – ● ● ?> ● <? ● ● ?> setcookie("views", "", time() - 1);
  • 16. Example
  • 17. Google App Engine (PHP) ● SDK Installation ● Engine APIs ● ● Users API Storage API etc Application Structure ● ● ● Application Upload ● MySQL Datastore
  • 18. Google App Engine (PHP) YAML ● application: myapp ● version: 1 ● runtime: php ● api_version: 1 ● ● handlers: ● ● ● - url: /.* script: index.php url: /admin/.* ● script: admin.php ● login: admin
  • 19. Google App Engine (PHP) upload your app ● appcfg.py update myapp/ ● ● ● appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>
  • 20. MVC
  • 21. Frameworks - CodeIgniter
  • 22. Example
  • 23. Road Map ● Basics ● Forms ● Arrays ● MySQL Connectivity ● Sessions and Cookies ● Google App Engine (PHP) ● YAML ● Upload your app ● MVC ● Frameworks - CodeIgniter
  • 24. Thank You for your Attention Slide share: http://www.slideshare.net/masterofpcs Facebook: http://facebook.com/masterofpcs E-mail: masterofpcs@yahoo.com

×