•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,557 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,433 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 428 | Replies: 3
![]() |
•
•
Join Date: Oct 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hello experts,
I'm having some difficults with the code that i have used from one of the PHP, MySQL books. As the error that appears is in bold on line 17, and the error that shows is listed below:
"Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Testing PHP with MySQL uses online Tutorials\Testing_with_MySQL_Database.php on line 17"
Please help,
Thanks,
Mitesh
I'm having some difficults with the code that i have used from one of the PHP, MySQL books. As the error that appears is in bold on line 17, and the error that shows is listed below:
"Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Testing PHP with MySQL uses online Tutorials\Testing_with_MySQL_Database.php on line 17"
php Syntax (Toggle Plain Text)
<html> <body> <?php //Open connection to MySQL server $connection = mysql_connect('localhost','root') or die ('Unable to connect!'); // select database for use mysql_select_db('movies') or die ('Unable to select database!'); // create and execute query $query = 'SELECT * FROM movies'; $result = mysql_query($query) or die ('Error in query: $query. ' . mysql_error()); // check if records were returned if (mysql_num_rows(Sresult) > 0) { //Print HTML table echo '<table width = 100% cellpadding=10 cellspacing=0 border=1>'; echo '<tr><td><b>Customer ID/b</td><tr><td><b>Customer Full Name/b</td><tr><td><b>Date Of Birth/b</td>'; // iterate over record set // print each field while($row = mysql_fetch_row($result)) { echo '<tr>'; echo '<td>' . $row[0] . '</td>'; echo '<td>' . $row[1] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '</tr>'; } echo '</table>'; } else { // print error message echo 'No rows found!'; } // once processing is complete // free result set mysql_free_result($result); //close connection to MySQL server mysql_close($connection); ?> </body> </html>
Please help,
Thanks,
Mitesh
Last edited by ta5na : Oct 24th, 2007 at 10:41 am. Reason: please use code tags when posting code
Need a simple, powerful knowledgebase? Bigattichouse Knowledge Base finds the solution while you're still typing the problem.
http://www.bigattichouse.com/knowledgebase.html
http://www.bigattichouse.com/knowledgebase.html
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- php undefined offset error (PHP)
- cPanel copy php errors help (PHP)
- PHP testing server no syntax error just blank web page (PHP)
- PHP errors on netscape enterprise server (PHP)
- random page crashes in php (PHP)
- php adodb library connect remote mysql (PHP)
- Apache and PHP (PHP)
- Php newsletter error (PHP)
- Installin PHP .......... (PHP)
Other Threads in the PHP Forum
- Previous Thread: Help with mysql on unix
- Next Thread: PHP query strings not working with mod_rewrite


Linear Mode