Sadly though you will never look at case 3 in that code and whats the point of making a case 3 if you aren't going to look at it?
Ok, so here is my example from real code that I have wrote:
<?php
/**
* @author Phil Matu
* @copyright 2007
* @use To delete all IP Tracker records older than 1 day, can be run as a cron job.
*/
//This is meant to run on its own every day at midnight EST. No interaction required.
if (empty($dbusername)) { //incase login variables aren't set
???????????????????????
}
$dbconn=mysql_connect($dbserver, $dbusername, $dbpassword) or die ("No connection: ".mysql_error());
$q = mysql_db_query($dbname,"DELETE FROM iptracker WHERE Time < DATE_SUB(NOW( ),INTERVAL 86400 SECOND)") or die (mysql_error()); //query deletes last 24 hours of data
?>
Choices:
1. $dbusername = "podnet_live";
2. include ("config.php");
3. $dbusername = array ("podnet_live", "password", "localhost");
4. $dbusername = new db();