At first, I've already looked at this, this and this.
I've received the following error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 220 bytes)
I'm working with php 5.4
and sql Anywhere 11
.
The solution to this is according to this is putting ini_set('memory_set',-1);
in my php-file
, but after doing this I get another error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3 bytes)
EDIT: my code is
<?php
ini_set('memory_set',-1);
$connect = sasql_connect("UID=username;PWD=pass");
echo "Connection succeed";
$result = sasql_query($connect, "SELECT * FROM table1, table2");
if(!$result){
echo "sasql_query failed";
return 0;
} else {
echo "query completed successfully\n";
sasql_result_all($result);
}
sasql_close($conn);
?>
I hope someone can help me.
SOLUTION:
I've found the solution: I've added a WHERE (columnName1 = columnName2)
, split the result and it works again, relative fast!
<?php
$connect = sasql_connect("UID=username;PWD=pass");
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$results_page = 100;
$start_from = ($page-1) * $results_page + 1;
$result = sasql_query($connect, "SELECT TOP $results_page START AT $start *
FROM table1, table2 WHERE (columnName1 = columnName2)");
if(!$result){
echo "sasql_query failed";
return 0;
} else {
echo "query completed successfully\n";
sasql_result_all($result);
}
sasql_close($conn);
?>
Ofcourse I add in my php-page
a <a href="<?php echo $page -1; ?>">Previous</a>
and a <a href="<?php echo $page + 1; ?>">Next</a>
Thanks to you all for the help!