Jump to content

Fold in Mysql num rows


maxrjc

Recommended Posts

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().
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

Where is your code? Please, give it us.  8)

 

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. :P

 

<?
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.