I have the following in php:
public function myfunction($v){
//ini_set("memory_limit","32M");
$v=mysqli_real_escape_string($this->connection,$v);
$stmt=mysqli_prepare($this->connection,"SELECT * from TABLE WHERE MATCH(column) AGAINST($v)");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows=array();
mysqli_stmt_bind_result($stmt,$row->column1,$row->column2);
while (mysqli_stmt_fetch($stmt)) {
$rows[]=$row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt,$row->column1,$row->column2);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
print_r('this is a test');
print_r($rows);
}
This is searching a longtext column that has a fulltext index…..
Running this code (w/ the ini_set commented out) I get a memory size exhausted error. When I uncomment the ini_set part and increase the memory I get no output and no errors (not even ‘this is a test’ gets printed).
Why am I not getting any output (or at least an error statement) when I increase the memory? I have not adjusted my error reporting in php.
(Running the same statement directly in mysql (without increasing the memory limit) takes .0007 seconds)
Because you save all the records that mysql gave in your
$rowsarray.If the recordset is huge then you get that error.
Also your syntax with a double call of
mysqli_stmt_bind_result($stmt,$row->column1,$row->column2);isn’t that good looking