Hello... PHP: if($X1 < $X2 && $Z1 < $Z2) { for($x = $X1 ; $x < $X2 ; $x++) { for($z = $Z1 ; $z < $Z2 ; $z++) { $query = $this->getDatabase()->prepare("SELECT date,time,player,x,y,z,event,block FROM database WHERE x='$x' AND z='$z' "); $result = $query->execute(); $this->data = $this->fetchall($result); var_dump($data); //return array(0) {} } }var_dump($data); //return array(0) { } Thanks
Very laggy. You are executing a lot of database queries (($X2 - $X1 + 1) * ($Z2 - $Z1 + 1) queries). Undefined variable. I don't see definition of $data anyway. No idea what you are asking. What's wrong? Unknown method. What is $this->fetchall()? Unknown method. What is $this->getDatabase()? I have no idea what your database returns.
Sorry My brain just can't work today PHP: //Copy form a plugin :Ppublic function fetchall($result){$row = array();$i = 0;while($res = $result->fetchArray(SQLITE3_ASSOC)){$row[$i] = $res;$i++;}return $row;}public function getDatabase() { return $this->database;}//tpying error not $this->data but $dataif($X1 < $X2 && $Z1 < $Z2) {for($x = $X1 ; $x < $X2 ; $x++) {for($z = $Z1 ; $z < $Z2 ; $z++) {$query = $this->getDatabase()->prepare("SELECT date,time,player,x,y,z,event,block FROM ServerLog WHERE x='$x' AND z='$z' ");$result = $query->execute();$data = $this->fetchall($result);}}var_dump($data); //$data return array(0) {} but doesn't contain any value?}}
And did you make sure your ServerLog table is not empty? And don't put your query in a for loop. Did you know that there is an SQL operator called "less than"?