Not entering into database

I am making my site to have submissions sent in from users.

The site is live, and when someone tries to submit something long it never gets inserted into the database. However, it works from my machine.

I had someone in another state add a long content post and it never showed, but when they entered a short one…viola!

This is my query:

$storysql = "INSERT INTO content (mid, uid, date, content) VALUES ('2','$uid','$date','$content')";

I have my database row set to “LONGTEXT” should I be using something else?

query is correct, but how you are getting the user data…?
is there any max limit of characters in the textarea or something like that?

<form method="post" action="media.php?a=4">
          		<textarea rows="15" cols="60" name="drunkstory"></textarea><br /><br />
          		<input type="submit" name="storysubmit" value="Submit" /><br /><br />
          		Do NOT include any HTML tags, as they will be removed when you submit the form.
          		</form>

$content=$_POST[‘drunkstory’];

echo $content; // echo it, for testing

and then insert into database, and see is there any difference.

I have it set as:

$content = trim($_POST[‘drunkstory’]);

try for echoing it.
to confirm it…

I echoed it, and it showed up for me. Do you want to give it a try?

I have it on a live server so you can try.

I tried a few more things, but I still can not get the bit to enter into the database.

Perhaps seeing the FULL code may be in order

I switched around some code now and it seems to be working, at least for the time being.

My original code was:

nl2br(trim($_POST['drunkstore']))

But I read elsewhere that it is better to have it like so:

trim(nl2br($_POST['drunkstory']))

Any comments on this?

Preceding or trailing new lines are affected, dependent on your preference.


<?php
$string = 'string' . "\\r\
";

var_dump(
  trim(nl2br($string))
); # string(12) "string<br />"

var_dump(
  nl2br(trim($string))
); # string(6) "string"