home  launcher  guestbook
w3schools.com
cd_catalog.xml
html.html
htmlpage.html
out.html
help.txt
mysqlinit.txt
signature.txt
action.php
action1.php
actioni.php
catalog.php
catalog.save.php
emailphp.php
emailphptest.php
emailphptext.php
form.php
form1.php
formphp.php
formphp1.php
formphpi.php
getcd.php
getenv.php
getenv1.php
henrylogin.php
mysqlcreate.php
mysqlcreate1.php
mysqlcreate2.php
mysqlcreate3.php
mysqlcreate4.php
mysqlcreatei.php
mysqlcreatetable.php
mysqldel.php
mysqldel1.php
mysqldelete.php
mysqldelete1.php
mysqldeletei.php
mysqldeli.php
mysqldriver.php
mysqldriver1.php
mysqldriveri.php
mysqldriversave.php
mysqlinsert.php
mysqlinsert1.php
mysqlinserti.php
mysqlitable.php
mysqltable.php
mysqltable1.php
mysqltablei.php
oopinsert.php
out.php
outout.php
processscript.php
processscript1.php
sakila.php
shuffle.php
shufflesave.php
tempstyle.php
test1.php
test2.php
testfile.php
testfname.php
testpost.php
testreceive.php
testx.php
testy.php
style.css
Number of files = 66
online compaq devendra athlon
kingston kingston2 kingston3 kingston4
pi pi2 pi3
Page created on February 11th 2014 and updated on November 30th. 2017.
Visitor number   number of hits
home  launcher   guestbook 
Display of file sakila.php
1. <?php
2. // Let's pass in a $_GET variable to our example, in this case
3. // it's aid for actor_id in our my_db database. Let's make it
4. // default to 1, and cast it to an integer as to avoid SQL injection
5. // and/or related security problems. Handling all of this goes beyond
6. // the scope of this simple example. Example:
7. // http://example.org/script.php?aid=42
8. if (isset($_GET['aid']) && is_numeric($_GET['aid'])) {
9. $aid = (int) $_GET['aid'];
10. } else {
11. $aid = 1;
12. }
13. // Connecting to and selecting a MySQL database named onwardov_testdb3
14. // Hostname: 127.0.0.1, username: your_user, password: your_pass, db: my_db
15. $mysqli = new mysqli('localhost', 'onwardov_henry', 'Xbloodychristmas7', 'onwardov_testdb3');
16. // Oh no! A connect_errno exists so the connection attempt failed!
17. if ($mysqli->connect_errno) {
18. // The connection failed. What do you want to do?
19. // You could contact yourself (email?), log the error, show a nice page, etc.
20. // You do not want to reveal sensitive information
21. // Let's try this:
22. echo "Sorry, this website is experiencing problems.";
23. // Something you should not do on a public site, but this example will show you
24. // anyways, is print out MySQL error related information -- you might log this
25. echo "Error: Failed to make a MySQL connection, here is why: \n";
26. echo "Errno: " . $mysqli->connect_errno . "\n";
27. echo "Error: " . $mysqli->connect_error . "\n";
28.
29. // You might want to show them something nice, but we will simply exit
30. exit;
31. }
32. // Perform an SQL query
33. $sql = "SELECT actor_id, first_name, last_name FROM actor WHERE actor_id = $aid";
34. if (!$result = $mysqli->query($sql)) {
35. // Oh no! The query failed.
36. echo "Sorry, the website is experiencing problems.";
37. // Again, do not do this on a public site, but we'll show you how
38. // to get the error information
39. echo "Error: Our query failed to execute and here is why: \n";
40. echo "Query: " . $sql . "\n";
41. echo "Errno: " . $mysqli->errno . "\n";
42. echo "Error: " . $mysqli->error . "\n";
43. exit;
44. }
45. // Phew, we made it. We know our MySQL connection and query
46. // succeeded, but do we have a result?
47. if ($result->num_rows === 0) {
48. // Oh, no rows! Sometimes that's expected and okay, sometimes
49. // it is not. You decide. In this case, maybe actor_id was too
50. // large?
51. echo "We could not find a match for ID $aid, sorry about that. Please try again.";
52. exit;
53. }
54. // Now, we know only one result will exist in this example so let's
55. // fetch it into an associated array where the array's keys are the
56. // table's column names
57. $actor = $result->fetch_assoc();
58. echo "Sometimes I see " . $actor['first_name'] . " " . $actor['last_name'] . " on TV.";
59. // Now, let's fetch five random actors and output their names to a list.
60. // We'll add less error handling here as you can do that on your own now
61. $sql = "SELECT actor_id, first_name, last_name FROM actor ORDER BY rand() LIMIT 5";
62. if (!$result = $mysqli->query($sql)) {
63. echo "Sorry, the website is experiencing problems.";
64. exit;
65. }
66. // Print our 5 random actors in a list, and link to each actor
67. echo "<ul>\n";
68. while ($actor = $result->fetch_assoc()) {
69. echo "<li><a href='" . $_SERVER['SCRIPT_FILENAME'] . "?aid=" . $actor['actor_id'] . "'>\n";
70. echo $actor['first_name'] . ' ' . $actor['last_name'];
71. echo "</a></li>\n";
72. }
73. echo "</ul>\n";
74. // The script will automatically free the result and close the MySQL
75. // connection when it exits, but let's just do it anyways
76. $result->free();
77. $mysqli->close();
78. ?>
79.