html - php register script not adding to mysql database
Just wondering what I'm doing wrong here guys. This is my register screen, I'm using an older version of php as im following a tutorial. The script so far detects missing fields and existing usernames, however when I try to register new user it doesnt add to the mysql database ?
<!DOCTYPE html> <html lang="en"> <head> <title> Exercise 3</title> <meta charset="utf-8"> </head> <body> <?php $name = “Frank”; $age = “28”; var_dump($name); echo "<br>"; print_r($name); echo "<br>"; var_dump($age); echo "<br>"; ?> </body> </html>
There are lot of things you need to change:
I am assuming that your connecting to your database twice i.e
config.phpand by using
Your website is highly vulnerable to SQL injection. So use
mysqli_real_escape_stringor some other functions to prevent from such attacks.
In the below query:
Remove those brackets like this:
mysqlis being deprecated.