Page 1 of 1
PHP mistakes you keep making?
Posted: Wed Jan 21, 2009 6:18 pm
by JAB Creations
I just blew like an hour trying to find out why JavaScript was returning nine rows instead of ten in my chat room when you first entered. Then I thought hmm, no amount of commenting out is working, maybe check the server? So I looked at the MySQL and sure enough, it was returning ten rows. I looked at the PHP output and saw nine rows. But there was nothing wrong with the file! Then I looked up and saw I had mysql_fetch_assoc set twice for the same query! DOH!
So what mistakes are other people making? Let us bask in the glory of confusion!

Re: PHP mistakes you keep making?
Posted: Wed Jan 21, 2009 6:55 pm
by josh
Check out mysql_data_seek(). Id have to say my biggest mistakes are not unit testing enough.
Re: PHP mistakes you keep making?
Posted: Wed Jan 21, 2009 7:13 pm
by JAB Creations
Neat, thanks!

Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 9:07 am
by JayBird
Spending hours trying to figure out why a code change wasn't working on a site, only to realise you have uploaded it to the wrong server
Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 9:26 am
by Bill H
Spending hours trying to figure out why a code change wasn't working on a site, only to realise you have uploaded it to the wrong server.
Or not uploaded it at all.
Or re-uploaded the last change you were working on, instead of uploading this one.
Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 9:27 am
by Eran
Start using revision control and automatic hooks

Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 9:29 am
by Bill H
Start using revision control and automatic hooks
And miss the fun of trying to figure out why the change was not working on the server?
Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 9:33 am
by papa
JayBird wrote:Spending hours trying to figure out why a code change wasn't working on a site, only to realise you have uploaded it to the wrong server
Haha that's a classic.

Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 9:36 am
by Eran
And miss the fun of trying to figure out why the change was not working on the server?

Re: PHP mistakes you keep making?
Posted: Thu Jan 22, 2009 7:10 pm
by kaisellgren
When I test my script I notice my recent changes do not work, I keep thinking and thinking and debugging the script until I finally realize that all I have to do is to remove cache files x)
Right now that won't ever happen again - I made the caching to not happen when in DEBUG -mode
