![]() |
Need some help with an error
Ok so I've been trying to teach myself php and am doing pretty good so far. I am making a little newsletter sign up for a site and it works fine, but I get an error. From what I understand this error should not allow the script to continue if it happens, but it doesn't and the script runs. The error is:
Code:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource inCode:
if(isset($_POST['submit'])) { |
Correct me if I'm wrong but not all browses seem to send a undefined value for blank form fields, some tend to send '' (aka, nothing [blank string]).
PHP Code:
|
You're using mysql_num_rows() in 2 places and I'm guessing that it is the second one (after the INSERT) that is causing the error?
mysql_num_rows() only works on SELECT statements, for your INSERT statement, try using mysql_affected_rows() instead - that should return 1 if the new info was inserted into the database, or -1 if there was a problem. More info: http://uk.php.net/manual/en/function...ected-rows.php |
| All times are GMT. The time now is 06:43 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0