craiggerz Posted March 28, 2007 Share Posted March 28, 2007 Hi guys, I'm new to php and I'm trying to set up a form that you can select a "filter" and the results will show up. The problem is that nothing is showing up. I've attached it below if someone could tell me what's going wrong that would be great, I'm trying to use a book as a guideline. Thanks! [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 28, 2007 Share Posted March 28, 2007 No code is shown. Quote Link to comment Share on other sites More sharing options...
craiggerz Posted March 28, 2007 Author Share Posted March 28, 2007 Sorry lets try this again. I even tried setting $breedName within the PHP file so it's not the HTML file that is calling it that is the problem, there must be something wrong with this code. Thanks again! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title></title> </head> <body> <?php require db.php; // Show all dogs with the breedname in a <table> function displayDogsList($connection, $query, $breedName) { // Run the query on the server if (!($result = @ mysql_query ($query, $connection))) showerror(); // Find out how many rows are available $rowsFound = @ mysql_num_rows($result); // If the query has results ... if ($rowsFound > 0) { // ... print out a header print "Dogs of $breedName<br>"; // and start a <table>. print "\n<table>\n<tr>" . "\n\t<th>Wine ID</th>" . "\n\t<th>Wine Name</th>" . "\n\t<th>Year</th>" . "\n\t<th>Winery</th>" . "\n\t<th>Description</th>\n</tr>"; // Fetch each of the query rows while ($row = @ mysql_fetch_array($result)) { // Print one row of results print "\n<tr>\n\t<td>{$row["dog_id"]}</td>" . "\n\t<td>{$row["name"]}</td>" . "\n\t<td>{$row["price"]}</td>\n</tr>"; } // end while loop body // Finish the <table> print "\n</table>"; } // end if $rowsFound body // Report how many rows were found print "{$rowsFound} records found matching your criteria<br>"; } // end of function // Connect to the MySQL server if (!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect"); // Secure the user parameter $regionName $breedName = mysqlclean($_GET, "breedName", 30, $connection); if (!mysql_select_db($databaseName, $connection)) showerror(); //$breedName = "Schnoodle"; // Start a query ... $query = "SELECT * FROM dog"; // run the query and show the results displayDogsList($connection, $query, $breedName); ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
shaunrigby Posted March 28, 2007 Share Posted March 28, 2007 print "\n<tr>\n\t<td>{$row["dog_id"]}</td>" . "\n\t<td>{$row["name"]}</td>" . "\n\t<td>{$row["price"]}</td>\n</tr>"; Change to: print "\n<tr>\n\t<td>$row["dog_id"]</td>" . "\n\t<td>$row['name']</td>" . "\n\t<td>$row['price']</td>\n</tr>"; See if that works... Also view the source of your page in your browser, what is being printed? Quote Link to comment Share on other sites More sharing options...
craiggerz Posted March 28, 2007 Author Share Posted March 28, 2007 That doesn't seem to work. All that is showing up for my page source is the following, which is obviously not correct. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title></title> </head> <body> Quote Link to comment Share on other sites More sharing options...
craiggerz Posted March 28, 2007 Author Share Posted March 28, 2007 I didn't figure it out, but I completely started over and it works now so please don't worry about this anymore. Thanks! Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted March 28, 2007 Share Posted March 28, 2007 take off the error suppressors in your mysql functions... Quote Link to comment Share on other sites More sharing options...
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.