I am wanting to let my users sort through the cars by Car Year, Car Model, Username, and a few other options
Right now it sorts by username only and users have no other way to find a car.
I'm not looking for the code handed to me I am just looking for th ebest place to start.
PHP Code:
// ############################################################################
// ############################# LIST ALL GARAGES #############################
// ############################################################################
if ($_REQUEST['do'] == 'list')
{
globalize($_REQUEST, array('pagenumber' => INT, 'perpage' => INT));
$perpage = intval($perpage);
if ($perpage == 0 or $perpage > 200)
{
$perpage = 25;
}
if (intval($pagenumber) == 0)
{
$pagenumber = 1;
}
$limitlower = ($pagenumber - 1) * $perpage + 1;
$limitupper = ($pagenumber) * $perpage;
$counter = 0;
$garagecount = $DB_site->query_first("
SELECT COUNT(*) AS garages FROM " . TABLE_PREFIX . "vbgarage_users
");
$numberpages = $garagecount['garages'] / $perpage;
$numberpages = ceil($numberpages);
if (!isset($pagenumber) or ($pagenumber < 1) or ($pagenumber > $numberpages))
$pagenumber = 1;
$pos = ($pagenumber - 1) * $perpage;
$result_list = $DB_site->query("
SELECT * FROM " . TABLE_PREFIX . "vbgarage_users ORDER BY userid ASC LIMIT $pos,$perpage
");
$counter = 0;
$count = 0;
while ($list = $DB_site->fetch_Array($result_list) AND $counter++ < $perpage)
{
$count++;
$list['lastactivity'] = vbdate($vboptions['dateformat'],$list['lastactivity'],true);
$user = fetch_userinfo($list[userid]);
eval('$listbits .= "' . fetch_template('vbgarage_listbits') . '";');
}
$result_latest = $DB_site->query("
SELECT * FROM " . TABLE_PREFIX . "vbgarage_images ORDER BY vbgarageid DESC LIMIT 5
");
while ($latest = $DB_site->fetch_Array($result_latest))
{
eval('$latestbits .= "' . fetch_template('vbgarage_latestbits') . '";');
}
$pagenav = construct_page_nav($garagecount[garages],"vbgarage.php?$session[sessionurl]do=$_REQUEST[do]&perpage=$perpage");
$navbits = construct_navbits(array('' => 'vBGarage'));
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('vbgarage_listgarage') . '");');
}
Thats a whole lot of code for me to digest at once. I'm not to familiar with PHP just learning it.
I would a start to rearrange that to allow users to sort by their choice?
Thats