Answer the question
In order to leave comments, you need to log in
Why does not write the text to the database?
Actually, there is a small table with 4 fields (2 integer and 2 text fields, see Fig.)
Now I set both the table and the fields to compare the encoding: 'UTf8'
There is a Code that writes the data transferred from the form to the database in these fields, but for some reason if I pass 2 text fields (phraseseng and phrasesrus), then nothing is written there. If I suppose I write down the type field one, then everything is recorded well.
Here is the code:
header("Content-Type: text/html; charset=utf-8");
$type= (int)$_POST['Section'];
$phrases_eng = $_POST['phrases'];
$phrases_rus = $_POST['translate'];
require_once 'database_connect.php';
$link = mysql_connect($host, $user, $password) or die("MySQL сервер недоступен!".mysql_error());
mysql_select_db($database,$link) or die("Could not select examples");
mysql_query("SET NAMES 'utf8'",$link);
$result=mysql_query("INSERT INTO `tourist_phrases` (`type`,`phrases_eng`,`phraserus`) VALUES ('$type','$phrases_eng','$phrases_rus')", $link);
Answer the question
In order to leave comments, you need to log in
What am I doing wrong?
VALUES()
not closed and $phrases_eng
without quotes. database_connect.php
and connect it like this: $link = require_once 'database_connect.php';
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question