Doing a project for class, but I can’t seem to get this to work:
$account = $_GET['account'];
mysql_query("INSERT INTO my_bank (Account) VALUES ('"$accounts"')");
If I change that second line to:
mysql_query("INSERT INTO my_bank (Account) VALUES ('TEST')");
Then it works. I’m guessing this is an issue with quotations, but I haven’t been able to find a method that works. Any guaranteed fallback on how quotations should work?
Basic PHP syntax:
and since you’re just starting out with PHP, you should be aware of SQL injection attacks. Adding in some attack mitigation code (e.g.
mysql_real_escape_string()) and some comments saying WHY you’re using m_r_e_s() may score some bonus points from your prof.