jfkirkpatrick 0 Posted January 18, 2012 Report Share Posted January 18, 2012 I am trying to print the employees as a way of verifying my setup including Apache, phpMyAdmin, MySQL, etc. I downloaded the code from the website and reviewed the errata sheet for any errors. I used phpMyAdmin (5.2.17) to set up the database, load the data using the scripts downloaded from the website, etc, so I feel this part of the effort is satisfactory. Set up user and password and changed mysql.inc.php (pg 18) accordingly. The only difference is, because IIS and Wamp Server is on my computer (I will uninstall these products today.). I have been starting phpMyadmin with "http://localhost:8080/phpmyadmin/ because of these other products. I have changed 'config.inc.php' to reflect 'localhost:8080'. So I feel that I have done the setup sucessfully. I use Aptana Studio 3 as my editor and Xampp 1.7.7 to start MySQL 5.1 and phpMyAdmin. When I execute 'dept_form.html' from Aptana using either Firefox or IE8 browers, the initial screen appears, etc. Once I hit 'Submit" the following message appears across the screen: Department Employees "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 " {$row['last_name']}, {$row['first_name']} Email: {$row['email']} Phone Extension: {$row['phone_ext']} \n"; } // End of WHILE loop. } else { // No employees. echo ' There are no employees listed for the given department. '; } mysql_close($dbc); } else { // Invalid department ID! echo ' Please select a valid department from the drop-down menu in order to view its employees. '; } ?>" Which is the code from 'dept_results.php' line 11 (approx) after 'if (mysql_num_rows($r) ....". Any suggestions? Thx John Quote Link to post Share on other sites
Larry 428 Posted January 18, 2012 Report Share Posted January 18, 2012 That's because you're not loading the HTML form through a URL, which means you're not running the PHP script through a URL, so the PHP code is not being executed. To be clear, the book does assume basic comfort with PHP and MySQL. Quote Link to post Share on other sites
jfkirkpatrick 0 Posted January 18, 2012 Author Report Share Posted January 18, 2012 Thank you for your quick reponse. I have several manuals in the mail to bring me up to speed in MySQL and PHP. I will most likely hold off until I have studied these topics more. Thx again John Quote Link to post Share on other sites
HartleySan 826 Posted January 27, 2012 Report Share Posted January 27, 2012 Shameless marketing plug, but might I recommend Larry's PHP and MySQL book? It's really good, and you should be familiar with the format. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.