我收到以下错误:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 220 bytes)
我正在使用php 5.4
和sql Anywhere 11
。
对此的解决方案是根据这个放入ini_set('memory_set',-1);
my php-file
,但这样做之后我得到另一个错误:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3 bytes)
编辑:我的代码是
<?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);
?>
我希望有一个人可以帮助我。
解决方案:我找到了解决方案:我添加了一个WHERE (columnName1 = columnName2)
,拆分结果,它再次工作,相对较快!
<?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);
?>
当然,我添加了我php-page
的 a<a href="<?php echo $page -1; ?>">Previous</a>
和 a<a href="<?php echo $page + 1; ?>">Next</a>
感谢大家的帮助!