Skip navigation.
Home

Add new comment

Drinking on the job...

Wonky Code

A friend of mine works in Germany as a Java developer/Oracle DBA. He's quite intelligent, making a decent 6 figure income in a meager 16 hour work day.

He tells me in Germany beer is nearly cheaper than water. In fact, I hear about the cheap beer a lot! I'm starting to suspect that the cheap beer and the number of German PHP WTFs I'm getting is not a coincidence.

This is today's WTF. There are a few newbie things but the WTF is where the array from mysql_fetch_row() is separated into variables only to be immediately jammed into another array.

Thanks to elias for sending this in.

<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
               
extract($_POST);
       }else{
               
extract($_GET);
       }

include(
"config.inc.php"); $verbindung = @mysql_connect("$MySQL_Host","$MySQL_User","$MySQL_Passw");

$abfrage = "SELECT name,adresse,ort,oeffnung,clublink,groesse,floors,
            preise,besonder,bildlink,musik,clubtyp from club where id=$id"
;
$zeilen1 = mysql_select_db("$dbname");
$zeilen2 = mysql_query($abfrage,$verbindung);
$spalten_anzahl = mysql_num_fields($zeilen2);
$p=0;
while(list(
$name,$adresse,$ort,$oeffnung,$clublink,$groesse,$floors,
           
$preise,$besonder,$bildlink,$musik,$clubtyp) = mysql_fetch_row($zeilen2))
{
    
$xname[0] = "$name";
    
$xadresse[0] = "$adresse";
    
$xort[0] = "$ort";
    
$xoeffnung[0] = "$oeffnung";
    
$xclublink[0] = "$clublink";
    
$xgroesse[0] = "$groesse";
    
$xfloors[0] = "$floors";
    
$xpreise[0] = "$preise";
    
$xbesonder[0] = "$besonder";
    
$xbild[0] = "$bildlink";
    
$xmusik[0] = "$musik";
    
$xclubtyp[0] = "$clubtyp";
    
$p=$p+1;
}
mysql_close($verbindung);
?>

Reply




*

  • Web and e-mail addresses are automatically converted into links.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <p> <br /> <br>