Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..HELP!

Results 1 to 16 of 16
  1. #1
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    ! Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..HELP!

    Why am I getting this error when im trying to registrer?

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\app\class.engine.php on line 102

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\app\class.engine.php on line 102

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\app\class.engine.php on line 102
    Table 'r63b.users' doesn't exist

    Code:
    Code:
    <?php
    
    namespace Revolution;
    if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
    class engine
    {
    	private $initiated;
    	private $connected;
    	
    	private $connection;
    	
    	
    	final public function Initiate()
    	{
    		global $_CONFIG;
    		if(!$this->initiated)
    		{
    			$this->setMySQL('connect', mysql_connect);
    			$this->setMySQL('pconnect', mysql_pconnect);
    			$this->setMysql('select_db', mysql_select_db);
    			$this->setMySQL('query', mysql_query);
    			$this->setMySQL('num_rows', mysql_num_rows);
    			$this->setMySQL('fetch_assoc', mysql_fetch_assoc);
    			$this->setMySQL('fetch_array',mysql_fetch_array);
    			$this->setMySQL('result', mysql_result);
    			$this->setMySQL('free_result', mysql_free_result);
    			$this->setMySQL('escape_string', mysql_real_escape_string);
    			
    			$this->initiated = true;
    		
    			$this->connect($_CONFIG['mysql']['connection_type']);
    		}
    	}
    	
    	final public function setMySQL($key, $value)
    	{
    		$this->mysql[$key] = $value;
    	}
    	
    	
    	/*-------------------------------Manage Connection-------------------------------------*/
    	
    	final public function connect($type)
    	{
    		global $core, $_CONFIG;
    		if(!$this->connected)
    		{
    			$this->connection = $this->mysql[$type]($_CONFIG['mysql']['hostname'], $_CONFIG['mysql']['username'], $_CONFIG['mysql']['password']);
    			
    			if($this->connection)
    			{
    				$mydatabase = $this->mysql['select_db']($_CONFIG['mysql']['database'], $this->connection);
    				
    				if($mydatabase)
    				{
    					$this->connected = true;	
    				}
    				else
    				{
    					$core->systemError('MySQL Engine', 'MySQL could not connect to database');
    				}
    			}
    			else
    			{
    				$core->systemError('MySQL Engine', 'MySQL could not connect to host');			
    			}
    		}
    	}
    	
    	final public function disconnect()
    	{
    		global $core;
    		if($this->connected)
    		{
    			if($this->mysql['close'])
    			{
    				$this->connected = false;
    			}
    			else
    			{
    				$core->systemError('MySQL Engine', 'MySQL could not disconnect.');
    			}
    		}
    	}
    	
    	/*-------------------------------Secure MySQL variables-------------------------------------*/
    	
    	final public function secure($var)
    	{
    		return $this->mysql['escape_string'](stripslashes(htmlspecialchars($var)));
    	}
    	
    	/*-------------------------------Manage MySQL queries-------------------------------------*/
    	
    	final public function query($sql)
    	{
    		return $this->mysql['query']($sql, $this->connection) or die(mysql_error());
    	}
    	
    	final public function num_rows($sql)
    	{
    		return $this->mysql['num_rows']($this->mysql['query']($sql, $this->connection));
    	}
    	
    	final public function result($sql)
    	{
    		return $this->mysql['result']($this->mysql['query']($sql, $this->connection), 0);
    	}
    	
    	final public function free_result($sql)
    	{
    		return $this->mysql['free_result']($sql);
    	}
    	
    	final public function fetch_array($sql)
    	{
    		$query = $this->mysql['query']($sql, $this->connection);
    		
    		$data = array();
    		
    		while($row = $this->mysql['fetch_array']($query))
    		{
    			$data[] = $row;
    		}
    		
    		return $data;
    	}
    	
    	final public function fetch_assoc($sql)
    	{
    		return $this->mysql['fetch_assoc']($this->mysql['query']($sql, $this->connection));
    	}
    
    
    
    
    
    
    
    
    }
    ?>


  2. #2
    Sorcerer Supreme QuixFounder is offline
    Member +Rank
    Aug 2012 Join Date
    United KingdomLocation
    284Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Some screenies would help abit more:)

  3. #3
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    This is after i press Register:


    This is the code:

  4. #4
    Gaby is offline
    Grand MasterRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    It basically says that you don't have a table called users... lol.

  5. #5
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,613Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    You tried reading the errors and understand what is going on?

  6. #6
    Sorcerer Supreme QuixFounder is offline
    Member +Rank
    Aug 2012 Join Date
    United KingdomLocation
    284Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    As BaasHotel said, i think you need the SQL so you can insert users into your database,

  7. #7
    Sorcerer Supreme Bozzie is offline
    Member +Rank
    Aug 2011 Join Date
    ur mumLocation
    275Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Read the errrors before making posts, clearly says the users table doesn't exist.

  8. #8
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Sorry, im kinda new at this. I downloaded the SQL from here. If I make a table called users, what should i type in that table?

  9. #9
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,613Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Quote Originally Posted by sn00w View Post
    Sorry, im kinda new at this. I downloaded the SQL from here. If I make a table called users, what should i type in that table?
    Just import the database that you got with your download.

  10. #10
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    I did but the table users didnt follow.

  11. #11
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,613Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Quote Originally Posted by sn00w View Post
    I did but the table users didnt follow.
    Then you dont have a correct database or correct database settings.

  12. #12
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Quote Originally Posted by HillBilly View Post
    Then you dont have a correct database or correct database settings.
    So what can I do?

  13. #13
    Gaby is offline
    Grand MasterRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Quote Originally Posted by sn00w View Post
    So what can I do?
    First run this SQL in your database:
    PHP Code:
    SET @@global.sql_mode ''
    and restart your mysql.
    Then import the database you got from that tutorial.

  14. #14
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Quote Originally Posted by BaasHotel View Post
    First run this SQL in your database:
    PHP Code:
    SET @@global.sql_mode ''
    and restart your mysql.
    Then import the database you got from that tutorial.
    Thanks, but I've fix it already, I downloaded another SQL.
    But please, do you think you can help me with an error? When im trying to enter my client it loads and then it turn black. After a while it turns white and an error says: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261904 bytes) in C:\xampp\htdocs\app\tpl\class.html.php on line 27

    Can you please help me? :)

  15. #15
    The Omega Superfun is offline
    Grand MasterRank
    Dec 2006 Join Date
    The NetherlandsLocation
    5,221Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Set your memory limit in the php.ini higher

  16. #16
    Member sn00w is offline
    MemberRank
    Sep 2013 Join Date
    30Posts

    Re: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in..H

    Ok, where can I find php.ini?



Advertisement