PDA

View Full Version : [PHPmySQL] How? Make sortable table format of mySQL database



MasterT
06-08-2004, 12:11 PM
hello i have a database i just made and i want to lay it out like this http://www.mxtracks.us/mx/California/ that is all static HTML now and it can be sorted by City or Track Name by going to a different html document


i have made a mySQL database with this information and i want to place it all on a table like that and be able to sort it by anything i want and be able to search the database too.


i also have another problem the last updated date is in the format yyyy-mm-dd and i want it to be like January 1st, 2004 is that possible?




Thanks 4 reading
MasterT

HardCoded
06-08-2004, 10:35 PM
For the sort,


if($_GET['sort'])
{
$sql .= " ORDER BY {$_GET['sort']}";
}

For the search, try something like

if($_POST['query'])
{
$sql .= " WHERE description REGEXP '[[:<:]]{$_POST['query']}[[:>:]]'
}

and for the date


$sql = "SELECT DATE_FORMAT(last_updated, '%M %D, %Y')";