If your table column is named Eval #, you need to use backtick quotes: `Eval #`
Ow Mun Heng wrote:
Hi,
I have this problem, which could easily be solved through a name change but I would like to learn more.
There's a table set up from a MySQL query like this
row1) Eval # Title # Heads My Findings row2) P1000 Title1 6 This is my findings row3) P1223 Eg 2 3 2nd findings
row1 is the header columns, the title names are derived from sql statement executed as SELECT eval_no as "Eval #" etc..
row1 is also set up such that if the user clicks the link, it will trigger a SQL comand to sort it.
The problem here is the '#' sign/key. spaces are no problem. the $_GET['sort'] is not able to get the whole field, as such "Eval #" can only be recognised as "Eval" and thus sql is not able to sort it.
I've looked at the php.ini file and tried setting these 2 configs
<snip from php manual>
arg_separator.output string
The separator used in PHP generated URLs to separate arguments.
arg_separator.input string
List of separator(s) used by PHP to parse input URLs into variables. Note: Every character in this directive is considered as separator! </snip>
but it still does not work..
<snip> This is how the link looks like http://10.0.0.1/trackit/trackit-2003-07-28/view_set_tracker.php?sort=Eval%20 #&dir=ASC
Help... Please...
==========view_tracker.php============== $l_column_header = nl2br(mysql_field_name($l_results,$k));
echo nl2br(sql_sort_by_header($l_column_header, $l_column_header, sql_sort_cat, $sql_sort_dir) );
=============sql_functions=========== function sql_sort_by_header( $p_string, $p_sort_field, $p_sort, $p_dir ) { if ( $p_sort_field == $p_sort ) { # we toggle between ASC and DESC if the user clicks the same sort order if ( 'ASC' == $p_dir ) { $p_dir = 'DESC'; } else { $p_dir = 'ASC'; } } echo '<a href="view_set_tracker.php?sort=' . $p_sort_field . '&dir=' . $p_dir . '">'. $p_string .'</a>'; } =================view_set_tracker.php================ $_SESSION['sql_sort_cat'] = ''; $_SESSION['sql_sort_dir'] = $GLOBALS['g_default_sql_sort_dir']; $_SESSION['sql_sort_cat'] = $_GET['sort'];
if (!empty( $_GET['dir'] )) { $sql_sort_dir = $_GET['dir']; }
header_redirect_html("view_tracker.php"); }
?>
=================================
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia DID : 03-7870 5168
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php