Added exists function to database object
This commit is contained in:
		
							parent
							
								
									ba599d5d1b
								
							
						
					
					
						commit
						6947b726f0
					
				| @ -251,6 +251,20 @@ class Database | |||||||
|         return $row ? $row[0] : null; |         return $row ? $row[0] : null; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Execute an SQL query and returns a bool indicating if any data was returned | ||||||
|  |      */ | ||||||
|  |     public function exists(string $query, array $args = []): bool | ||||||
|  |     { | ||||||
|  |         $_start = microtime(true); | ||||||
|  |         $row = $this->execute($query, $args)->fetch(); | ||||||
|  |         $this->count_time("exists", $_start, $query, $args); | ||||||
|  |         if ($row==null) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the ID of the last inserted row. |      * Get the ID of the last inserted row. | ||||||
|      */ |      */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user