How to burn a database in 3 steps...
Submitted by phrax on Thu, 2005-01-20 15:10.
DB Hoopla
Thanks to Au5lander for sending in this WTF he found on pastebin.com. I'm thinking that this might be some benchmarking code because it'll make the database work so hard!
The code basically goes like this:
- If record does not exist, insert data into the first column.
- If record exists, update the record with data for the second column
- Repeat for each additional column
- Watch database burn...
<?php
while(list($key,$value) = each ($arraywerk))
{
if($arraywerk[$key] != '')
{
//doorloop de colommen in de tabel
for ($i = 0; $i < $numcolumns; $i++)
{
$keyQ = mysql_field_name($fields, $i);
if ($key == $keyQ)
{
if ($insertidstatus==false) {
//create the insert query
$sql = "INSERT INTO werkgever ($key) VALUES ('$value')";
mysql_query($sql, $socket);
$insertid = mysql_insert_id();
$insertidstatus=true;
} else {
$sql = "UPDATE werkgever SET $key='$value' WHERE vacatureID='$insertid'";
mysql_query($sql, $socket);
}
}
}
}
}
$sql = "UPDATE werkgever SET werkgeverstatusID=0 WHERE vacatureID='$insertid'";
mysql_query($sql, $socket);
?>