| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Colin -
 
 
 Joined: 18 Mar 2003
 Posts: 2
 Location: England
 
 | 
			
				|  Posted: Tue Mar 18, 2003 1:46 am    Post subject: PHP - MySql Function Problems |   |  
				| 
 |  
				| I'm getting an erro when trying to count the number of records obtained from a mysql db. the error states: 
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\Abyss Web Server\htdocs\login.php on line 6
 
 the code is:
 
 $db = mysql_connect("localhost", "root");
 mysql_select_db("itjobhunt", $db);
 $sql = "Select * FROM agency WHERE agy_ID = '" + $agy_Account + "'";
 $result = mysql_query($sql);
 $results = mysql_num_rows($result);
 echo "<br>$results<br>";
 
 I have an idea that this may be to do with the setup of PHP but may be completely wrong.  Any idea's??
 |  | 
	
		| Back to top |       | 
	
		|  | 
	
		| rIkLuNd -
 
 
 Joined: 15 Jan 2003
 Posts: 25
 Location: Örebro, Sweden
 
 | 
			
				|  Posted: Tue Mar 18, 2003 6:46 am    Post subject: |   |  
				| 
 |  
				| Try changing your query: 
 $sql = "Select * FROM agency WHERE agy_ID = '" . $agy_Account . "'";
 
 --------------------------------------------------------^----------------^
 This is what I changed.
 |  | 
	
		| Back to top |          | 
	
		|  | 
	
		| Colin -
 
 
 Joined: 18 Mar 2003
 Posts: 2
 Location: England
 
 | 
			
				|  Posted: Tue Mar 18, 2003 9:42 am    Post subject: |   |  
				| 
 |  
				| Didn't seem to make any difference. |  | 
	
		| Back to top |       | 
	
		|  | 
	
		| rIkLuNd -
 
 
 Joined: 15 Jan 2003
 Posts: 25
 Location: Örebro, Sweden
 
 | 
			
				|  Posted: Tue Mar 18, 2003 9:43 am    Post subject: |   |  
				| 
 |  
				| try adding some debug code: $result = mysql_query($sql) or die(mysql_error());
 By doing this, you may find out about errors that you might miss now...
 |  | 
	
		| Back to top |          | 
	
		|  | 
	
		|  |