Random Pic Problem
Posted: Fri Aug 21, 2009 8:25 am
Im trying to choose a picture from my website but;
when it writes 'rated but time id ' and 'No Ratings Id ' it passes the id to the string $tottyChosen. That's Fine
But when it randomly chooses another and echos 'Got Girl ID ' it doesnt pass the id to the string even though it prints it on screen.
Can anyone help please
Thanks
- [li]it must be random[/li]
[li]each pic is only allowed to be rated once per day[/li]
Code: Select all
if($_GET[id]){
}
else
{
$totNum = mysql_num_rows(mysql_query("SELECT * FROM totties"));
echo $totNum."<br/>";
$totSelect = mysql_fetch_array(mysql_query("SELECT * FROM totties ORDER BY rand() LIMIT 0,1"));
$totCheck = mysql_fetch_array(mysql_query("SELECT * FROM ratings WHERE imgId='$totSelect[tottyId]' AND username='$userUsername'"));
if($totCheck[id]){
$timeDif = time() - $timeLimit;
$totCheck2 = mysql_fetch_array(mysql_query("SELECT * FROM ratings WHERE id='$totCheck[id]' AND time > $timeDif"));
$xCount=1;
if ($totCheck2[id]){
while($totCheck2[id]){
$totSelect = mysql_fetch_array(mysql_query("SELECT * FROM totties ORDER BY rand() LIMIT 0,1"));
$totCheck = mysql_fetch_array(mysql_query("SELECT * FROM ratings WHERE imgId='$totSelect[tottyId]' AND username='$userUsername'"));
$totCheck2 = mysql_fetch_array(mysql_query("SELECT * FROM ratings WHERE imgId='$totSelect[id]' AND time > $timeDif"));
if ($xCount==$totNum * 2){
echo "Rated All Girls";
$noGirls='1';
break;
}
$xCount++;
}
[color=red][b]$tottyChosen = $totSelect[tottyId];
echo "Got Girl ID ".$totSelect[tottyId];[/b][/color]
} else {
$totDetails = mysql_fetch_array(mysql_query("SELECT * FROM usr_images WHERE id='$totSelect[tottyId]'"));
echo "Rated But Time ID ".$totCheck[imgId];}
$tottyChosen = $totCheck[imgId];
}else{
[color=red][b]echo " No Ratings ID ".$totSelect[tottyId];
$tottyChosen = $totSelect[tottyId];[/b][/color]
}
}
echo "<br/>".$tottyChosen;when it writes 'rated but time id ' and 'No Ratings Id ' it passes the id to the string $tottyChosen. That's Fine
But when it randomly chooses another and echos 'Got Girl ID ' it doesnt pass the id to the string even though it prints it on screen.
Can anyone help please
Thanks