INSERT INTO不使用php / mysqli

the following code does not work when inserting text containing a hash symbol:

$query = mysqli_query($mysqli,"INSERT INTO users (username,password) VALUES ('".$username."','".$password."')");

the variables are escaped, but have not been manipulated otherwise. an example of what i'm inserting would be "hello#1". there is also no error being outputted via mysqli_error.

thank you.

ANSWER:

/facepalm

after some debugging; problem was actually related to the ajax request used to pass the strings.

turns out ajax can't pass a hash symbol directly and instead requires the use of encodeURIComponent().

/facepalm

after some debugging; problem was actually related to the ajax request used to pass the strings.

turns out ajax can't pass a hash symbol directly and instead requires the use of encodeURIComponent().

try this

$insert=mysqli_query($con,"insert into tablename set password='$password',username='$username'") ;