+ 1
Why is my data not being inserted into my database, need help
im getting an error in my sql syntax but the error message clearly shows that the $_POST is fetching the values but still not being submitted...what might be the issue, I know its in the sql query https://code.sololearn.com/wv6ckkjswCW0/?ref=app
10 ответов
+ 6
What was the error message? can you elaborate more on this matter?
+ 5
i think that you can't use database on sololearn
+ 4
Have you checked whether there is any character that needs escaping in the input? e.g. if there's a single quote (') in one of the $_POST data you're working on? if there is a character that needs escape sequence you need to check and work on that part first.
And I don't know what DBMS you are using, but can you explain the reason why you wrapped the field values in curly brackets {}? I rarely see such method for inserting data, but maybe I'm not aware of such method : )
(Edit)
Can you dump the sql query content and post it here? I don't know but if we can see it maybe we can find the problem.
+ 2
it said I had an error in my sql syntax and I should check the reference of the version im using....
the connection is made successfully then the problem is inserting the data to my database using the query.
+ 2
found a fix and efficient way to go about this :)
first collect the form data and store as variables after escaping.. like this :
$name = mysqli_real_escape_string($connection, $POST['name']) ;
that collects the form data and stores it in the variable container $name ... then it can be inserted into the database from the query string.
+ 1
@CoD4 isnt your query string open to sql-injections..I know its not a good idea to take direct input as text from users when communicating with the database
+ 1
I also just found the method recently.. it was an article on stackoverflow, ill try find it and post link
and the only special character is an @ on the email input.how do I escape it?
0
Take a look at https://code.sololearn.com/w7hWMBVuVE58/#php
you're also not escaping the input based on this query either so a " could break the query.
0
not here im testing a project on a local server but im having a challenge
0
https://www.sololearn.com/discuss/1238801/?ref=app
hey guys.. if u dont mind can i get help on this post?