PDA

View Full Version : need help with php


MDS
06-02-2007, 10:59 PM
I need help making changes to my site emporialive.com (http://www.emporialive.com/)

I want to change the "New Games" to a list of 7 random games.

below is a clip of the code but could send the full php if that would make it easier.

First is the header line that I could change to say "random games" Edit: I went ahead and changed the title

then the current code that calls up the new games that would have to be changed

then the site currently has a link for a random game which does basically what I want the list to do.

Is there any easy way to call up random games?

<td width='12%' align='center' class='headertableblock'>New Games</td>
<td width='50%' align='center' class='headertableblock'>Latest Scores</td>
<td width='10%' align='center' class='headertableblock'>Top Players</td>






$newgames = run_query("SELECT gameid,game,id FROM phpqa_games ORDER by id DESC LIMIT 0,7"); Changed to times_played
while($g=mysql_fetch_array($newgames)){
echo "<img height='20' width='20' src='arcade/pics/$g[0].gif' alt='$g[1]' /><a href=\"Arcade.php?play=$g[0]\">$g[1]</a><br />";
}
?>
</td>
<td class='arcade1' valign='top' align='center'>
<table><td align='left'>
<?php

$selectfrom = run_query("SELECT * FROM phpqa_scores ORDER BY phpdate DESC LIMIT 0,5");

while($s=mysql_fetch_array($selectfrom)){

$parse_stamp = date($datestamp, "$s[5]");
echo "<a href='Arcade.php?action=profile&amp;user=$s[1]'>$s[1]</a></i> scored <i>$s[2]</i> in <a href='Arcade.php?id=$s[6]'><i>$s[7]</i></a> on $parse_stamp<hr>";
}
?>











echo "Viewing Arcade Index</td><td class='arcade1' style='width:1px'><a href='?play=".$f[0]."'>Random&nbsp;Game</a>";

}
echo "</td></tr></table></div>";

?>


next thing is making member emails private by not listing them under there profile. edit: done

MDS
06-03-2007, 12:29 AM
update: the database options that will list the games are:
id
games
times_played

now I set it to times played and it show which has been played the most, is there something I can tell it so it will be reversed as show played least?

davidw
06-03-2007, 9:16 AM
Without looking at all the code, you could probably do something like this
$randomgame = run_query("SELECT gameid,game,id FROM phpqa_games ORDER BY RAND() LIMIT 1");

davidw
06-03-2007, 9:18 AM
now I set it to times played and it show which has been played the most, is there something I can tell it so it will be reversed as show played least?change DESC to ASC in a query will reverse the order

MDS
06-03-2007, 1:40 PM
Now why didn't I think of that :) Thanks


edit BTW if anyone wants to try it out they can.