SolveErrors
PHP

Make clickable headers to sort data

4 views

Im new at php and i have something like this, but i want to make this code so if i clicked on firstname it will sort the firstnames out or if i clicked lastname it would sort lastnames... Can someone please show me how? Thanks

PHP Code:
include('connect-db.php');?$result?=?mysql_query("SELECT?*?FROM?reports?WHERE?coc='Yes'?ORDER?BY?$sort")?or?die(mysql_error());????????????????????????????????echo?"First?NameMiddle?InitialLast?Name";?while($row?=?mysql_fetch_array(?$result?))?{??????????????????echo?"";?????????????????echo?''?.?$row['firstname']?.'';?????????????????echo?''?.?$row['middle']?.?'';?????????????????echo?''?.?$row['lastname']?.?'';?????????????????echo?''?.?$row['branch']?.?'';?????????????????echo?''?.?$row['incidentdate']?.?'';?????????????????????echo?''?.?$row['returndate']?.?'';?????????????????????echo?''?.?$row['policenumber']?.?'';?????????????????echo?''?.?$row['saplid']?.?'';?????????????????echo?''?.?$row['vcoc']?.?'';?????????????????????????????????????????????????????????????????????????echo?''?.?$row['notes']?.?'';?????????????????????echo?"
.$row['photo']?.">?????????????????.$row['photo']?."?width='55'?height='65'?border='0'>
"
;?????????????????echo?"
.$row['file']?.">".$row['file']?."
"
;?????????????????????????????????????????????????????????????????????????????????????????????????echo?"";???????????}???????????//?close?table>?????????echo?"";??>

More PHP fixes

PHP-General - Header tag not directing to specified pageHow to cut down the size of a URL?index.php wont load index.html will loadWarning: oci_free_statement(): 3 is not a valid oci8 statement resourcePage 2 - str_replaceSyntax help - $random_name