maxrjc Posted September 16, 2011 Share Posted September 16, 2011 Now he sayes other fold: Wrong parameter count for mysql_num_rows() in /home/a5078111/public_html/registerpage.html on line 146 Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/ Share on other sites More sharing options...
WebStyles Posted September 16, 2011 Share Posted September 16, 2011 mysql_num_rows($return); will give you the number of rows that will be returned by whatever SQL query you have in $return. according to the manual here: mysql_num_rows Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows(). Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/#findComment-1269885 Share on other sites More sharing options...
gristoi Posted September 16, 2011 Share Posted September 16, 2011 num rows returns the number of rows affected / retrieved from a mysql query. I dont know who or what 'he' is but it is not a fold in the code, whatever that is? Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/#findComment-1269886 Share on other sites More sharing options...
maxrjc Posted September 16, 2011 Author Share Posted September 16, 2011 mysql_num_rows($return); will give you the number of rows that will be returned by whatever SQL query you have in $return. according to the manual here: mysql_num_rows Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows(). Now hes sayes: Wrong parameter count for mysql_num_rows() in /home/a5078111/public_html/registerpage.html on line 146 Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/#findComment-1269889 Share on other sites More sharing options...
web_craftsman Posted September 16, 2011 Share Posted September 16, 2011 Where is your code? Please, give it us. Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/#findComment-1269899 Share on other sites More sharing options...
maxrjc Posted September 16, 2011 Author Share Posted September 16, 2011 Where is your code? Please, give it us. This is the code: Als iemand nieuw zich lid maakt wordt deze rang 1 gegeven dus member om iemand andere rechten te geven moet je naar de db gaan of zelf een scriptje maken. <? session_start(); ?> <font face=verdana size=1> <? if($_SESSION['login'] == "true"){ print " You have allready an account.";//because your logged in stupid } include('connect.inc.php'); if(!isset($_REQUEST['submit'])){ ?> <form method=post acion=""<? $_SERVER['PHP_SELF'] ?>""> <table> <tr> <td> <font face=verdana size=1>Username: </td> <td> <input type="text" name="name" maxlength="15"> </td> </tr> <tr> <td> <font face=verdana size=1>Password: </td> <td> <input type="password" name="pass1"> </td> </tr> <tr> <td> <font face=verdana size=1>Confirm: </td> <td> <input type="password" name="pass2"> </td> </tr> <tr> <td> <input type="submit" value=submit name="submit"> </td> <td> <input type="reset"> </td> </tr> </table> </form> <?php }else{ //request everything $dead = "false";//We make 'dead' if some fields are not filled in don't check for pass and name in db. $message = "<font face=verdana size=1>Pleas fill in all fields correctly:<br>"; $username = $_POST['name']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; $ip = $_SERVER['REMOTE_ADDR']; $status = "1";//1 member, 2,co-admin 3, admin //begin search for errors if(strlen($username) <= 1 or strlen($username) >=15){ $dead = "true"; $message .= "Username (2-14)<br>"; } if(strlen($pass1) < 6 or strlen($pass1) > 20 or $pass1 !== $pass2) { $dead = "true"; $message .= "Password (6-20) or passwords does not match"; } if($dead = "false"){ $username = strtolower(trim(strip_tags($username))); $pass1 = trim($pass1); $pass1 = md5($pass1); $query = mysql_query("SELECT * FROM members WHERE username ='$username'"); $aantalrijen = mysql_num_rows($query); if($aantalrijen == 1){ print "<font face=verdana size=1>Sorry, your username exists allready."; } else{ $query1 = "INSERT INTO members(username, password, ip, status) VALUES ('$username','$pass1', '$ip','$status')"; if(mysql_query($query1)){ print "<font face=verdana size=1>Well donne your now a member of the RTD group.<br><a href=login.php>Login</a>"; } } } elseif($dead == "true"){ print $message; } } ?> MOD EDIT: code tags added. Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/#findComment-1269971 Share on other sites More sharing options...
jcbones Posted September 16, 2011 Share Posted September 16, 2011 The database has an error on this query: $query = mysql_query("SELECT * FROM members WHERE username ='$username'"); Add in de-bugging: $query = mysql_query("SELECT * FROM members WHERE username ='$username'") or trigger_error(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/247268-fold-in-mysql-num-rows/#findComment-1270105 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.