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:
- find out the exact length that causes the problem.
- see what's going on in the string at around that length.
- try running the query in the mysql client.
- the bug might be something unexpected.
精彩评论