I'm getting this error:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1640 bytes) in C: \ AppServ \ www \ muweb \ class \ Connect.php on line 31
When I run these scripts:
index.php
<?php
require_once 'settings/Config.php';
require_once 'class/Connect.php';
require_once 'class/Characters.php';
$char = new Characters;
?>
<!DOCTYPE html>
<html>
<head>
<title>SELECT</title>
</head>
<body>
<table>
<thead>
<tr>
<th>Conta ID</th>
<th>Personagem</th>
<th>Dinheiro</th>
</tr>
</thead>
<tbody>
<?php
while ($get = $char->fetch()):
?>
<tr>
<td><?php echo $get['AccountID']; ?></td>
<td><?php echo $get['Name']; ?></td>
<td><?php echo $get['Money']; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</body>
</html>
Connect.php
<?php
class Connect {
private $_cn;
private $_db;
public function __construct() {
$this->Connection();
$this->Database();
}
private function Connection() {
$this->_cn = mssql_connect(HOST, USER, PASS);
if ($this->_cn == false) {
die('Connection error!');
}
}
private function Database() {
$this->_db = mssql_select_db(BASE, $this->_cn);
if ($this->_db == false) {
die('Select database error!');
}
}
public function execute($query) {
$execute = mssql_query($query);
if ($execute == false) {
die('Execute error:' . $query);
} else {
return $execute;
}
}
public function row($query) {
return mssql_fetch_row($query);
}
public function fetch($query) {
return mssql_fetch_array($query);
}
public function num($query) {
return mssql_num_rows($query);
}
}
characters.php
<?php
class Characters extends Connect {
public function fetch() {
$fetch = $this->fetch($this->execute("SELECT * FROM Character WHERE AccountID = 'guialves95'"));
return $fetch;
}
public function num() {
$num = $this->num($this->execute("SELECT * FROM Character WHERE AccountID = 'guialves95'"));
return $num;
}
}
I've done everything but I can not solve the problem, a quick search, some cases have managed to solve by adding this line of code:
ini_set('memory_limit','-1');
It did not work for me, what is the solution to this problem?
I have with me, that, my loop
is out of control.