- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
Uhm....(leaving aside the rest of this WTF) the last comment about the consistent misspelling of Query.... While it grates me to see qeury instead of query, one of the most important principles of readable code is consistency (more important to be consistent than correct in choosing conventions and variable names). If anything, this at least is a good thing....
Admin
Admin
Sorry I'm off-topic, but I just got this in a captcha.
[image]Admin
Maybe I gotta give up C and go PHP if my brain is failing me....
Admin
"Damn Foreigners - can't go anywhere in the world without meeting any" - Antony Aloysius St. John Hancock.
Admin
FTFY.
Admin
Qeury Farie, I like you. You are a lot more tolerable than Fake Nagesh and his sock puppets and their sock puppets. As a fake Indian I become bored of all the garbage that Nagesh has spewed. Thanks for being a being of incorrect spelling but somewhat correct grammar.
Captcha:populus. I hope you are populus too.
Admin
I'm clearly very very far in the minority on this, but depending on what kinds of places it's used, I'm kind of okay with the function's return value changing.
The alternative is to always return an array of arrays, and then to unwrap it after every use that expects a single row. (I can't think of many good options here, other than selecting the most recent x by ordering and limiting 1?)
When you're doing that, and your query fits your expected pattern, unwrapping the single result is not the most horrible thing to do.
Yes, it would be better to just have an overload like query_single that unwraps it for you, but for something you knock out quick, because you DON'T want to build an entire framework.. I don't see anything egregious about this.
Admin
Admin
Mistype $qeury once; every time after that it's $q<letautocompletedotherestforme>.
Admin
What if the first word in your select query is WITH?
Admin
Don't know what to think of a guy that was responsible for a language that opens modal dialogs to show "compiler" errors.
Admin
Waving the BS Flag on all the "kudos for recognizing the need for a PHP SQL wrapper."
I know bupkis about PHP but after 2 minutes reading this I can say convincingly "Well, everyone knows PHP needs a good SQL wrapper."
This "nice try" is a true WTF because a) it is crap yet 2) he put it into production on a "paid gig" which means d) he's unprofessional, incompetent, and probably dyslexic.
Admin
Admin
Trfwtf is not that its php or that the code is that bad. Im not saying its great either but this codemonkey at least understands the basic principles on how to deal with queries. Ive seen way worse...
The real wtf is the submitter for not doing a code review during the interview. Php is a powerfull language in hands of those who know what theyre doing!
Captcha: i typed this from my new tab, sorry for spelling errors
Admin
Gee, he's invented everything, inclueding his own kewl turmenology.
Admin
You 'Sir, ju'st made my day.
Admin
TRWTF is that drupal's codebase isn't much better than that
Admin
I have wrapped your mysql lib. Pray I don't wrap it any further.
Admin
Did you ever stop to think that maybe this was wrote before PDO or the prevalence of frameworks? There was a point in time where you pretty much had to if you wanted something sane to work with. However, if this was wrote in the last several years I'll agree with you. Even if it wasn't the developer needs to be slapped for doing such a shitty job.
Admin
This isn't WTF code, this is newb code. Sure it's bad, but not WTF. I've noticed almost all the code snippets recently are not WTF, just bad ... not evil bad. This list is turning into experts looking down their noses at the less advanced programmer.
Sure a lot of these bad programmer think "mine will be better", but that shows (misplaced) confidence.
Sigh.
Admin
Except he was paid for this code so the newb defense is invalid.
Admin
(SELECT 1 + 1) UNION (SELECT 1 - 1)
But if won't work as you'd expect with LIMIT 5,1.
Admin
Admin
I just fixed a bug in another part of the application.
Because
did not trigger the if() statement because
did not trigger because of the f*cking semicolon at the end of the query. Ehr qeury. I'm going to cry in a corner now.