So I'm having the same problem as the folks here:
- Problem inserting a long text in database column MYSQL PHP
- Unable to save large text in mysql thru php
But I didn't see any genuine solutions to the problem besides the hack the guy posted in the first one to split the text up. The scripts have been tested and save to the database fine when it's a small amount of text, and the php script can save the largetext to a txt file fine as well. So the problem is somewhere on the Database side.
EDIT: The field I am posting to is already set to LONGTEXT
Here are my scripts:
post.php
<?php
$data=$_POST["SData"]; //Around 76kb of text
$rName=$_POST["regName"];
include_once './db_functions.php';
$db = new DB_Functions();
$db->insertText($rName, $data);
?>
db_functions.php
//Insert Text Data into DB
public function insertText($regId, $sdata) {
try {
mysql_query("UPDATE users SET textdata = '$sdata' WHERE id = '$regId'");
}
catch (PDOException $e) {
$output = 'Error performing update: ' . $e->getMessage();
}
}
I have the following questions:
What is the maximum datasize(amount of characters?) that I can send via PHP to a MySQL database? All the text i'm attempting to post is not necessary, so I could potentially limit it before I POST it. (But the more, the better)
Is there an actual solution where I could send large datachunks over PHP?
Potentially using 'the mysqli_stmt::send_long_data' found here: http://php.net/manual/en/mysqli-stmt.send-long-data.php ? Are there any examples of this being used that aren't just in the manual?
Any help would be greatly appreciated, thanks!!