My apologies again, the actual text "You have won $random1 silver! <br />{$wi['gender']} majesty rewards you well." is stored in a field from my database. Depending on a random result, the text will be different each time in the fields ocsuc1, ocsuc2, ocsuc3, ocfail1, and ocfail2.
This is the actual code I am working on:
$sq=$db->query("SELECT wk.*,un.*,oc.* FROM worker wk LEFT JOIN occupation oc ON wk.wkoc=oc.ocid LEFT JOIN unemp un ON wk.wkitm=un.wid WHERE wk.wkid={$_GET['ID']} AND wk.wkuid=$userid");
$wi=$db->fetch_row($sq);
if($wq['wkaction']>$wi['ocaction'])
{
die("Sorry, {$wi['wname']} is just too tired to work again this day, try again tomorrow.<br />
<a href='worker.php'>> Back</a>");
}
$db->query("UPDATE worker SET wkaction=wkaction+1 WHERE wkid={$_GET['ID']} AND wkuid=$userid");
if($wi['wsex']=="Male"){$gen=his;}else if($wi['wsex']!="Male"){$gen=her;}
if($wi['wsex']=="Male"){$gend=him;}else if($wi['wsex']!="Male"){$gend=her;}
if($wq['wkdom']<=rand(1,100))
{
$numb=rand(1,4);
$upkeep=($wi['ocup']*$numb)*$wq['wkrk'];
$gain=($wi['ocpay']*$numb)*$wq['wkrk'];
$num=rand(1, 5);
switch($num)
{
case 1:
print $wi['ocsuc1'];
break;
case 2:
print $wi['ocsuc2'];
break;
case 3:
print $wi['ocsuc3'];
break;
case 4:
print $wi['ocfail1'];
break;
case 5:
print $wi['ocfail2'];
break;
}
}
In each 'case' I have a different script requiring the different $gen, $gend, & $numb arrays (and their calculated results in $gain and $upkeep). I was tying to describe what I was actually trying to do without throwing a bunch of code that, to me, would have been confusing
