im running an image voting page on my site..
right now the main index file includes a prep file, which contains the query on whos picture to show next (randomly
--------prep.php3--------
function getRandomUser()
{
srand((double)microtime()1000000);
$connection = mysql_pconnect(SQL_SERVER, SQL_UID, SQL_PWD);
mysql_select_db(SQL_DB, $connection);
$sql = "select from user where active=1 and inrotation = 1";
$query = mysql_query($sql);
$rows = mysql_num_rows($query);
if ($rows==0)
return Array('id'=>-1, "uid"=>'', "picurl"=>'');
$row = rand(0, $rows - 1);
mysql_data_seek($query, $row);
$record = mysql_fetch_array($query);
return $record;
}
--------/prep.php3--------
now i want to get something where theres a drop down, or a radio button or something that gives the option of either males or females, or couples (for the future).. how can i do something like that? i shouldnt have to make a whole new page just for it.. i want to maybe like getRandomUserMales or Females etc...
--------index.php3--------
include("prep.php3");
if ($op == 'rate')
{
$id = code2id($id);
$record = $record = vote($id, $r);
if ($record)
{
$oldid = $record["id"];
$oldurl = $record["picurl"];
$oldaverage = $record["voteaverage"];
$oldaverage = sprintf("%1.1f", ($oldaverage / 10));
$oldvotes = $record["votecount"];
}
$id = 0;
} elseif ($op == 'bonk') {
$id = code2id($id);
bonk($id);
$message = "The incident has been reported";
}
$id = code2id($id);
if ($id == 0)
while (($id==0) || ($id==$oldid))
{
$record = getRandomUser();
$id = $record["id"];
}
else
$record = getUser($id);
$id = id2code($record["id"]);
$active = $record["active"];
if ($active != 0)
$url = htmlspecialchars($record["picurl"]);
else
$url = "removed.gif";
$thisurl = "http://www.abda53.com/vote/index.php3?id=$id";
$bonkurl = "http://www.abda53.com/vote/index.php3?op=bonk&id=$id";
$newurl = 'http://www.abda53.com/vote/user/index.php3?op=new';
$geekboard = 'http://voting.abda53.net';
$rating = autoLogin();
?>
--------index.php3--------
not sure if that helps or not..
also i just thought of this..
is there a way to like click a button or whatever, and it will change the include file? like the default include file is RandomUser and the if you click a radio button, it will change it to RandomMale or RandomFemale?