![]() |
Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Hi, In my book "PHP and mySQL Web Development" listing 10.2 has a line of code: $num_results = mysql_num_rows($result); that throws an error on linux but not on windows machine. error=Warning: Supplied argument is not a valid MySQL result resource Code runs fine on php-triad in windows but mySQL under redhat 7.3 throws the error. Here is entire code of the example. <? @ $db = mysql_pconnect("localhost"); // I'm thinking this may be wrong if (!$db) { echo "Error: Could not connect to database. Please try again later."; exit; } mysql_select_db("events"); $query = "select * from events"; $result = mysql_query($query); $num_results = mysql_num_rows($result); // this line throws error echo "<p>Events found: ".$num_results."</p>"; for ($i=0; $i <$num_results; $i++) { $row = mysql_fetch_array($result); echo "<p><strong>".($i+1).". Title: "; echo stripslashes($row["title"]); echo "</strong><br>Time: "; echo stripslashes($row["time"]); echo "<br>Date: "; echo stripslashes($row["date"]); echo "<br>Speaker: "; echo stripslashes($row["speaker"]); echo "<br>Description: "; echo stripslashes($row["review"]); echo "<br>EID: "; echo stripslashes($row["eid"]); echo "</p>"; } ?> Any help appreciated. Mike Volmar *************************************************** Michael Volmar, PhD Curator Fruitlands Museums 102 Prospect Hill Road Harvard, MA 01451 978-456-3924x228 (tel) mvolmar at fruitlands.org http://www.fruitlands.org ****************************************************
![]() |
|
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |