Assistance/optimization for a very simple code
Posted: Wed Oct 15, 2008 1:32 pm
I guess it's rather simple question, but I'm stuck.
Is it possible to make this code (and codes like these) simpler? This looks to me unnecessary repetitive.
Thanks!
Is it possible to make this code (and codes like these) simpler? This looks to me unnecessary repetitive.
Code: Select all
$clname = array('about', 'portfolio', 'links', 'web', 'photo')
$fetchmsg = @mysql_fetch_object($dbselect) or die();
if ( $_GET["p"] == $clname[0] ) { $vardump = $fetchmsg->about; }
if ( $_GET["p"] == $clname[1] ) { $vardump = $fetchmsg->portfolio; }
if ( $_GET["p"] == $clname[2] ) { $vardump = $fetchmsg->links; }
if ( $_GET["p"] == $clname[3] ) { $vardump = $fetchmsg->web; }
if ( $_GET["p"] == $clname[4] ) { $vardump = $fetchmsg->photo; }