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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -