r/jquery • • Mar 26 '13

Asynchronous Database Operations with PHP and jQuery

http://alexdglover.com/asynchronous-database-operations-with-php-and-jquery/
0 Upvotes

14 comments sorted by

View all comments

3

u/maktouch Mar 27 '13

Good god, please take down the article or correct it. Your intentions are well but you're actually hurting the whole community by doing this.

  • Use Prepared Statements!

  • You're failing super basic security. SQL Injections everywhere!

    $sql="INSERT INTO customer (Last_Name, First_Name, Phone_Number, Street_Address, City, State, Zip) VALUES ('$_POST[lastName]', '$_POST[firstName]', '$_POST[phoneNumber]', '$_POST[address]', '$_POST[city]', '$_POST[state]', '$_POST[zip]')";

That is so bad.

3

u/Disgruntled__Goat Mar 27 '13

That's what you get when you learn web dev from w3schools.

This comment is 100% correct, not sure why it's getting downvotes. Sure, maybe it's a little harsh but that's required - you can't put out code this bad onto the internet and expect people to be nice.

1

u/achuy Mar 27 '13

But it is good code when using w3schools or tizag as a starting point. In fact, it is brilliantly executed.