瀏覽代碼

Updated to fix 2 count() errors

i12bretro 4 年之前
父節點
當前提交
5822b76eb0
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      _Downloads/mongodb_test.php

+ 2 - 2
_Downloads/mongodb_test.php

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