Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Your dumbest PHP mistakes
Old 07-27-2004, 08:26 PM Your dumbest PHP mistakes
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Let's bring a little humor in the PHP forum What is the dumbest mistake you've ever made when coding a PHP app?

Mine is probably when I was creating a file-upload script with multiple fields. I had a loop to loop through the fields, but I did it wrong. Instead, the script was copying the same first field over and over again until the script timed out (30 secs). (The nature of the script was to name the file based on the current time, so it wasn't overwriting the same file either, I had hundreds of the one file. Sucked.)
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-27-2004, 08:36 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
Yea, that's pretty good, Chroder. I don't think I can top that one.

But my biggest problem is forgetting to declare a variable global if I need to do so and of course the value never comes out right because you're starting from zero instead of some value. I have spent hours debugging and chasing one missing global.
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 07-27-2004, 08:38 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
You don't use E_ALL as your error_reporting? Saves countless hours of debugging.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 07-27-2004, 08:44 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
No, I don't. I just fired up Apache one day and started playing with PHP. Bought a functions book and everything else is pretty straightforward. For anyone who has programmed at all, there's no need for an "Intro to PHP", IMO.

What is the basic premise of E_ALL error reporting?
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 07-27-2004, 08:47 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
It reports almost everything. The thing I find most handy is when it compains about the use of an undefined variable. So if I used $bar = $foo + 1; but $foo didn't exist, it'd let you know. See here for an overview (and you can change it during the script with error_reporting(), you don't need to edit php.ini).
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 07-27-2004, 08:52 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
Thanks, Chroder, for the info & link -- I will take a look.

Sorry I ruined your thread.....
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 07-27-2004, 09:19 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
The stupidest thing I have ever done is probably...

When I was reading through tutorials and came across one of those, "This is what not to do with loops" type of tutorials. Well, I was curious about the effects of
PHP Code:
<?php
$var 
1;
while(
$var 2) {
    
$var++
}
?>
Needless to say I got an angry letter from my host at the time who, for some dumb reason, had their script timeout set to 2 minutes. The server went down before that though.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 07-27-2004, 10:02 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
lol I think we've all run into an endless loop at least once in our lives (Mine was on purpose though, back in grade 6 when I made an endless loop in C++ and called it a "virus" )
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 07-28-2004, 01:00 AM
Junior Talker

Posts: 3
Trades: 0
how about a stupid mysql msitake?

i was defining a table for counter-strike profiles and it took me about an hour to realize my field for favorite primary weapon defined as "primary varchar(25)" was interpreted as looking for a PRIMARY KEY.
minieye is offline
Reply With Quote
View Public Profile
 
Old 07-28-2004, 01:10 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Stupid mysql mistakes are welcome too

I've had my share of those too. For example, just the other day I was looking over 13 lines of a "SELECT" SQL query trying to find an error. It was the next day I realized I had completely forgot to include the FROM clause. In my defense, it was 3:30 in the moning
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 10-31-2004, 09:01 PM
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
My dumbest mistake was this...

I was converting an VBScript (ASP) function to PHP.

In VBS, the function returns are like this
Code:
Function MyFunc()
Dim i 
i = 25
MyFunc = i
End Function
You know that PHP functions are returned not like above...
Code:
function myfunc()
{
 $i = 25;
return $i;
}
After converting all the lines in the VBS to PHP, i just forgot to see the return statement.

That caused buffer overflow and crashed PHP. I was running it in CGI mode.

It took me 2 weeks to figure out that mistake.

That was an important lesson for me.
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE

Last edited by vivekar; 10-31-2004 at 09:04 PM..
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 10-31-2004, 10:28 PM
lothop's Avatar
Ultra Talker

Posts: 303
Trades: 0
This isnt too big a mistake, but back in the day it puzzled me,

Using capital letters for variables and wondering why it wouldnt work.
Syntax's normally cause me a phew problems
Used to think IF statements MUST have } else { or they wont work.

eg. IF ($var = 1) {
echo('hahha');
}

(I thought was impossible)





Mistakes other people have done.

Tried to make a php page without the file extenstion .php and wondering why it wont work.
My webdesign partner changed the password of the database (I was away for the long weekend (3days), he doesn't know php too well), I get back and he is having a "stroke" saying "The database is fuc*ed , It's crashed, make a new one!, the site has been down for 3 days! We will lose our affiliates"
Took me 5 minutes to find out that he had changed the database password.
__________________
Websites Created;
warscope.com
ratepayers.org.nz
lothop is offline
Reply With Quote
View Public Profile
 
Old 11-01-2004, 10:05 AM
Average Talker

Posts: 25
Trades: 0
I was working with drupal and couldn't track down this one bug that was spitting out an "e" at the top of the page. A week later I noticed that the file (a custom theme module) started with "e<?php". Retarded
joemc91 is offline
Reply With Quote
View Public Profile Visit joemc91's homepage!
 
Old 11-01-2004, 12:14 PM
lothop's Avatar
Ultra Talker

Posts: 303
Trades: 0



(I mean no offence, it just made me laugh when i first read it)
__________________
Websites Created;
warscope.com
ratepayers.org.nz
lothop is offline
Reply With Quote
View Public Profile
 
Old 03-13-2005, 11:35 AM
Logical Program's Avatar
Super Talker

Posts: 130
Location: Atlanta, Georgia
Trades: 0
HaHa! Imagine if we laughed about these things in the real world, everyone would call us nerds and whatnot for having programmatical laughter, LOL!

My most retarded mistake, was when I was trying to rename pictures before they got uploaded, added the time and converting spaces to underscores... Well, for some reason, it would tell me I had an incorrect filetype (An error I programmed in). About 3 days later, I realized that variables can't begin with a number! That F'ing sucked! LOL
__________________

Please login or register to view this content. Registration is FREE
- For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.
Logical Program is offline
Reply With Quote
View Public Profile Visit Logical Program's homepage!
 
Old 03-13-2005, 02:36 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Was editing a script the other day to add some text to a certain page in my site. Most things are included() into each page, but this text needed to be on the border, so I edited the layout file. I somehow messed up the conditional of which page to print the text on, so that it worked, but broke some image links I already had there. These were the links to an online application form for May Ball tickets, and I got frantic email telling me it was broken.
I then went back in and changed the conditional so they reappeared. What I didn't realise until later was that I'd got it wrong again, so that the links now appeared on ALL the pages on the site!! The third time round I finally fixed it!
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-13-2005, 03:12 PM
Gaffer Sports's Avatar
Ultra Talker

Posts: 397
Name: Steve
Location: Scotland
Trades: 1
Oh the joys of our mistakes.

My funniest has to be the time my host nearly threw me off the server. I was creating a script that created 2 files in their own folder, one readable and one writable. To cut a long story short, I made the readable first and being the lazy bam that I am, I saved that file and then saved it as the writable too, with the intention of changing the permissions.

Only problem was I got sidetracked and when i got back to the PC, I forgot about it and uploaded the scripts. I then went to bed and in the morning had a nice wee email from my host with a copy of their logs - made for a great read over my corn flakes.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
Gaffer Sports is offline
Reply With Quote
View Public Profile Visit Gaffer Sports's homepage!
 
Old 03-14-2005, 05:28 AM
Ultra Talker

Posts: 377
Trades: 0
The dumbest mistake are usualyy missing quotes or brackets
But I've got a funny mistake too yesterday. I've copied my API (well just simple engine) from one site to another site. Then I have to change an output of news a little (I'd like to trim a whole message to use it as annotation). I did it. But when I refreshed my window there were no result... I displayed all errors with E_ALL. But still nothing! I begin to doubt - who are crazy??? Me or PHP?
I changed a file few times, but still nothing. And then I looked at my API config file and discovered that I didn't chage a path leading to displayed template, so that one which I've edited wasn't displayed at all - it loaded a template from another folder...
__________________
andrews_john

Please login or register to view this content. Registration is FREE
andrews_john is offline
Reply With Quote
View Public Profile Visit andrews_john's homepage!
 
Old 03-14-2005, 05:57 AM
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
The stupids mistake I've ever made was not saving a file and wondering why it wasn't working... I read the code like 5 times, then after about 20 reads I noticed it was missing...
__________________

Please login or register to view this content. Registration is FREE
The future is now with 4D Realms
log2 is offline
Reply With Quote
View Public Profile
 
Old 03-14-2005, 07:55 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
Has to be when i emailed the wrong message out for a competition.

Everyones a winner.
Thank god only 100 odd played (most of whom accepted the mistake) but I had 1/2 dozen or so chasing freebie's.

Lesson learned and 4 years on no mistakes.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Reply     « Reply to Your dumbest PHP mistakes

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 6.41322 seconds with 12 queries