开发者

Mysql db doesnt save text if its too long

My problem is pretty much decribed with the title! I have this code that inserts data to the db:

<?php
require_once 'connection.php';
$pName = $_POST['scriptName'];
$pCode = $_POST['code'];
$group = $_POST['group'];
$descri = $_POST['descr'];
$lang = $_POST['lang'];
$date = date("Y-m-d");
$updateq = "INSERT INTO code_tb (id, Script_Name, Description, Code, Language, Date) VALUES ('NULL', '$pName','$descri', '$pCode', '$lang', '$date')";
$result=mysql_query($updateq);
echo "$pName . $pCode . $group . $descri . $lang . $date";
?>
开发者_高级运维

The Code field in my database is of type text.

When the code is too long it doesn't get saved in the db and I am not getting any error at all! If i shorten up the text string it works!

Might this be a stupid beginner mistake?


http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

here are the limits:

text is 2^16 <--- pretty big.

longtext is 2^32 <--- huge

seems unlikely that you are sending more than a LONGTEXT's gigs of data into an sql statement.

so:

  1. find out the exact length that causes the problem.
  2. see what's going on in the string at around that length.
  3. try running the query in the mysql client.
  4. the bug might be something unexpected.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜