PHP's limited MySQL and math functionality...
I've been using PHP for about 5 years and I like it a lot. However, two of my biggest complaints is that it has limited MySQL functionality and limited arithmetic operators. This isn't really a WTF but an example of what should be fixed in PHP.
I pray to the PHP gods! Please let me select a single field from a table! Please give me the modulus operator! I beg of thee!
Thanks to Wonko for sending this in.
<?php
$ix = mysql_fetch_array(mysql_query("SELECT * FROM map WHERE x=".$minX." AND y=".$minY." LIMIT 1")) or die(mysql_error());
$j = $ix['id'];
$i = 1;
$opp = "";
while ($i <= 625)
{
$opp .= "<input type='checkbox' name='d".$j."' value='1'>";
if ($i==25 || $i==50 || $i==75 || $i==100 || $i==125 || $i==150 || $i==175 || $i==200 || $i==225 ||
$i==250 || $i==275 || $i==300|| $i==325 || $i==350 || $i==375 || $i==400 || $i==425 ||
$i==450 || $i==475 || $i==500 || $i==525 || $i==550 || $i==575 || $i==600 || $i==625)
{
$opp .= "<br>\r\n";
$j = $j+226;
}
else
{
$j++;
}
$i++;
}
echo $opp;
?>
On another note. The site will be moving to Drupal. I've migrated over all the posts and the comments and putting together the PHPWTF theme for it. It should be done by next week. The change will bring some notable improvements.
- Automatic PHP Code highlighting
- Threaded Comment support
- WYSIWYG HTML comment support
- Clean URL's
- Better platform to develop new stuff
If you have any suggestions feel free to submit to them to [email protected], or you can just use the Submit WTF form. It all goes to the same place.