I have just started to learn MySQL and its syntax. My question is:
Are there some options to do this in a more readable way and use less quotes and escaping slashes? It seems to me 'a little stupid' how it is written so far. And also I think this is the problem why mysqli_escape_string()
isn't doing what I expect:
mysqli_set_charset($connection, 'utf8');
$string = "INSERT INTO pass_words(site_name,user_id,pass_id,email,question,answer) VALUE ("
.
' \' '.$site.' \' '
. ','.
' \' '
.$acc_name.' \' '
. ','.
' \' '
.$pass.' \' '
. ','.
' \' '
.$email.' \' '
. ','.
' \' '
.$question.' \' '
. ','
.' \' '
. ''.$answer.' \' '.')' ;
if($query = mysqli_query($connection, mysqli_escape_string($connection, $string))){
echo '<div style="color: #00FF99; margin: 0 0 20px 0;"> The Account Information has been added correctly.</div>';
}