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

5

u/ikeif Mar 27 '13

Everyone takin the time to criticize and tell him not to teach, yet no one comments on his site to help teach him...

2

u/da_n13l Mar 27 '13

I left a comment, to be honest I have written code like that when I first started out, when I look back on things I did in the past I cringe. I do commend the author for rolling his own solution, even if the results are insecure and badly coded. What I don't agree with though is him presenting this as a tutorial, it is not code that needs to be shared, it needs to be killed with fire!

1

u/ikeif Mar 28 '13

Thanks for being that guy.

I wish more people would comment constructively instead of silently belittling.

4

u/loodroomer Mar 27 '13

Backbone.js w/ Laravel or CodeIgniter would be the sane version of such a thing.

1

u/[deleted] Mar 27 '13

I saw a backbone and laravel post, but havent found one on backbone and codeigniter, do you have one?

2

u/loodroomer Mar 27 '13

Here's one written by a really smart guy: http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/

But at this point in time CI is falling out of favor with some, including Phil Sturgeon who wrote this article back in 2010. I think he would probably tell you to use Laravel over CI.

2

u/stonedoubt Mar 27 '13

check out the W3Schools PHP

FUCK NO

2

u/[deleted] Mar 27 '13

Articles like this are basically the reason why there're so many bad coders out there...

3

u/[deleted] Mar 27 '13

Welcome to 2006? Do people seriously write code this bad still? Horrible. Zero security with the database and no abstraction or models.

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.

-8

u/andey Mar 26 '13

PHP is so gross to look at.

To Gross;DR

0

u/[deleted] Mar 26 '13

Very insecure.