php - Long text entries not inserting into MySQL -
php - Long text entries not inserting into MySQL -
i have form 2 user-editable fields. 1 text field come in numerical id
, other uses tinymce input lengthy amounts of text saved mysql on submission:
if ( !empty ( $_post ) ) { $location_id = $_post['restaurant_id']; $content = $_post['content']; $query = "insert restaurant_reviews (location_id, text1, review_date) values ('$location_id', '$content', now())"; $execute = mysqli_query($dbc, $query); print_r($_post); }
the issue when little amounts of text submitted in form (by little amounts mean max of 2/3 normal paragraphs) record not generated in mysql. form submits every time few words of text in tinymce field.
irrespective of amount of text submitted in form, appears in post array when it's echoed out print_r function, doesn't far db. text1 column type longtext sure isn't problem. ideas?
i recommend utilize
$connection = mysqli_connect("database_host", "username", "password", "database_name"); $id = (int)mysqli_real_escape_string($connection, $_post['restaurant_id']); $content = mysqli_real_escape_string($connection, $_post['content']);
to escape characters may interfere sql statement
php mysql forms
Comments
Post a Comment