Death penalty, no trial. My PHP sucks THAT much.

July 27th, 2005 by Josh Houghtelin

Over the past 3 years I've made some big things in PHP. 80% of it sucks & should go straight to the lethal injection without trial. Whats realy been frustrating me lately is back when I started learning PHP I did all my Mysql Queries like this.

————————————————–
mysql_connect(localhost,$dusername,$dpassword);
@mysql_select_db($ddatabase) or die( “Unable to select database”);
$query=”SELECT * FROM notes WHERE id='$id'”;
$result=mysql_query($query);
$num=mysql_numrows($result);

$i=0;
while ($i < $num)
{
$date=mysql_result($result,$i,”date”);
$name=mysql_result($result,$i,”name”);
$note=mysql_result($result,$i,”note”);

echo “$date - $name $note”;
$i++;
}
————————————————–

Now thats horrid. Unfortunately I started off with a shitload of bad habbits from a book whos name i can't remember. Arg. Although it would be outdated anyway, needless to say it's not in publish anymore. Now realy lame shit like the script above isn't to annoying to dig through & clean up. Even if it is 50,000+ lines of it. heh. What gets me worse is the horrid way I formatted mysql inserts.

————————————————–
$query1=”INSERT INTO people values('','$fname1','$mi1','$lname1','M','$bday1','$bmonth1','$byear1','$address','$city','$state','$zip','$county');
$result1=mysql_query($query1);
————————————————–

So I have to find every one of those old insert statements & fix it before I can make any changes to the db otherwise shit just comes to a screetching hault. arg. I think carrying around the book I had & using it more as a reference manual totaly skrewed me from the start. That & I'm lazy. and I picked one hell of a dull scripting language to devote so much time to.

It's almost as annoying as it is cool to watch how I'm learning this stuff. It's painfully slow & I don't seem to catch onto the realy usefull shit until knowing such things will cause more work becuase I have to mop up behind myself. I should just go to school for this shit n' quit trying to re-invent the wheel.

I get way to cought up in making things happen with what I know to just say “skrew all the projects, I'm learning this to know this”. I know I'd save myself from so much discomfort it wouldn't even be funny. But then I'd have t

Posted in PHP


(comments are closed).