我正在运行以下查询,带有两个longtext字段(175& 525),我得到了内存错误。这个查询已经太长了还是其他事情发生了?
错误:致命错误:内存不足(已分配1310720)(尝试分配4294967296字节)
$query = "SELECT username, url, accountcreated, accountstatus, address, city, birthday, education, relation, gender, profile_story, intsettinga, intsettingb FROM users WHERE username=?";
$stmt = $db->stmt_init();
($stmt->prepare($query))|| fail('An error occurred: MySQL prepare', $db->error);
$stmt->bind_param("s",$username)|| fail('An error occurred: MySQL bind_param', $db->error);
$stmt->execute()|| fail('An error occurred: MySQL execute', $db->error);
$stmt->bind_result($screenname, $url, $created, $status, $address, $city, $bday, $education, $relation, $gender, $profile, $settinga, $ssettingb)|| fail('An error occurred: MySQL bind_result', $db->error);
$stmt->fetch() || fail('Profile not found');
$stmt->close();
$db->close();
答案 0 :(得分:0)
错误发生在bind_result,添加了$ stmt-> store_result();解决了它:
$stmt->execute()|| fail('An error occurred: MySQL execute', $db->error);
$stmt->store_result();
$stmt->bind_result($screenname, $url, $created, $status, $address, $city, $bday, $education, $relation, $gender, $profile, $settinga, $ssettingb)|| fail('An error occurred: MySQL bind_result', $db->error);
$stmt->fetch() || fail('Profile not found');
$stmt->close();
$db->close();