Jump to content
Larry Ullman's Book Forums

pgflrob

Members
  • Posts

    3
  • Joined

  • Last visited

pgflrob's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Correct. It is the default on PHP Mac 10.5.x I have your PHP / MySQL book but it is the second edition and things are different since Tiger. I used it to learn PHP itself. I am now trying to learn how to do a very, very, very interactive website. The users clicks around on the page and it is reconstructed (including new links) with each click. The "action" of each click is recorded in the database. Think of a chess game, or better yet a game of dominos (no set grid). If the user quits the database knows the status of the board game. Each time the user makes a move (clicks) the board is updated (i.e. the database knows which dominos are out, which are placed, who placed them, and where they are... I forgot about web root directory. I have another website(sic) there. Do I have to replace all those files with your example set, or should I change web root?
  2. Yes there is a MAMPP stack running. I tried http://localhost//Users/rob/Downloads/ajax_scripts/dept_form.html and got The requested URL /Users/rob/Downloads/ajax_scripts/dept_form.html was not found on this server.. http:/localhost// shows the default index page and I can run http://localhost//testphp (which is the typical <?php phpinfo(); ?> file).
  3. I am reviewing several books on how to build a truly dynamic website driven by a SQL database. I downloaded the samples (Mac OSX 10.5.x). I click on the HTML file dept_form.html and it comes up in Safari (I can open it also with FF). But when I click on the "go" button the php file does not "run" but displays. file:///Users/rob/Downloads/ajax_scripts/dept_results.php?did=1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Employees by Department</title> <style type="text/css" media="all">@import "style.css";</style> </head> <body> <h1>Department Employees</h1> <?php # dept_results.php // Validate the received department ID: $did = 0; // Initialized value. if (isset($_GET['did'])) { // Received by the page. $did = (int) $_GET['did']; // Type-cast to int. } // Make sure the department ID is a positive integer: if ($did > 0) { // Get the employees from the database... // Include the database connection script: require_once('mysql.inc.php'); // Query the database: $q = "SELECT * FROM employees WHERE department_id=$did ORDER BY last_name, first_name"; $r = mysql_query($q, $dbc); // Check that some results were returned: if (mysql_num_rows($r) > 0) { // Retrieve the results: while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { echo "<p><span class=\"name\">{$row['last_name']}, {$row['first_name']}</span><br /> <strong>Email</strong>: {$row['email']}<br /> <strong>Phone Extension</strong>: {$row['phone_ext']} </p>\n"; } // End of WHILE loop. } else { // No employees. echo '<p class="error">There are no employees listed for the given department.</p>'; } mysql_close($dbc); } else { // Invalid department ID! echo '<p class="error">Please select a valid department from the drop-down menu in order to view its employees.</p>'; } ?> </body> </html> I have to be doing something incredibly stupid. Rob
×
×
  • Create New...