L
L
lakemiller2019-05-03 14:39:30
PHP
lakemiller, 2019-05-03 14:39:30

Data not being entered into MySQL table?

There is a field where the user enters data, there is a button that sends this data to $_GET, after that the $_GETdata gets into the database, but only numbers are entered into the database, but lines are needed, in the database the type is text.
Form Code: Submission Code:
echo "<input type=text name=question>";

$question_text = $_GET['question'];
mysqli_query($link, 'INSERT INTO `html_questions` (question_id, question_text) VALUES ('.$i_question_id.', '.$question_text.')');

Need to enter $question_text
Entering numbers

5ccc27df7ab10449177822.png
Database

5ccc27f118385741949194.png
Entering letters

5ccc2842d82b7269513892.png
Database

5ccc285288b10837790208.png
Nothing changed.
PHP module for Joomla.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Ezhgurov, 2019-05-03
@lakemiller

Text values ​​in a SQL query must be wrapped in quotation marks.
Better yet, take a tutorial and learn what prepared queries and sql injections are . Your code is a red carpet inviting hackers to break into the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question