لمحترفي الويبPHP - معمو — الصفحة ٢٩٩

299 12. zip VARCHAR (5), 13. type VARCHAR (16) 14. primary key(id)); 15. 16. 17. XML 9 PHP 9 البرنامج النصي xml_dump.php (تابع) insert into xmladdressbook values (1, 'Neil', 'Armstrong', '555-555-1234', '[email protected]', '1 Moon Road', 'Lunar City', 'LN', '99999', 'Friend'); insert into xmladdressbook values (2, 'Buzz', 'Aldrin', '555- 555-1235', '[email protected]', '2 Moon Road', 'Lunar City', 'LN', '99999', 'Business'); function connect() { if (!$db = @mssql_pconnect("localhost", "mssqluser", "password")) { print ("<h1>Cannot Connect to the DB!</h1>\n"); return 0; } else { mssql_select_db("php", $db); return 1; 18. */ 19. 20. 21. 22. 23. 24. 25. 26. 27. } 28. } 29. 30. 31. 32. 33. 34. 35. 36. 37. if (connect()) { print('<?xml version="1.0"?>'); ?><addressbook><? $sql = "select * from xmladdressbook order by last, first"; $result = mssql_query($sql); while($row = mssql_fetch_array($result)) { ?> <contact type="<?=$row["type"] ?>"> <name> <last_name> <?=$row["last"]?></last_name> <first_name> <?=$row["first"]?></first_name> 38. 39. 40. 41. </name> 42. <details> 43. 44. <phone><?=$row["phone"]?></phone> <email><?=$row["email"]?></email>
ص٢٩٩

نص مستخرج آليًا من الصورة، وقد يقع فيه خطأ.