Explorar o código

Updated to fix 2 count() errors

i12bretro %!s(int64=4) %!d(string=hai) anos
pai
achega
5822b76eb0
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      _Downloads/mongodb_test.php

+ 2 - 2
_Downloads/mongodb_test.php

@@ -82,7 +82,7 @@
 	$query = new MongoDB\Driver\Query([],[]);
 	$result = $conn->executeQuery('phpDemo.state', $query);
 
-	if(count($result) > 0){
+	if($result){
 		echo '<h3>Reading data from MongoDB</h3>'.
 		'<table width="500" align="center">'.
 			'<thead>'.
@@ -98,7 +98,7 @@
 		
 		$query = new MongoDB\Driver\Query(['State'=> 'Massachusetts'],[]);
 		$result = $conn->executeQuery('phpDemo.state', $query);
-		if(count($result) > 0){
+		if($result){
 			$rs = $result->toArray()[0];
 			echo '<h3>Reading specific state from MongoDB</h3>'.
 			'The capital of '.$rs->State.' is '.$rs->Capital.'<br /><br />_id: '.$rs->{'_id'};