RE: [PHP] $_GET['sort'] & argument separator

2003-07-28 Thread Ow Mun Heng
It worked!!! Thanks VERY much. Now if someone could explain to me the
difference between urlencode and rawurlencode. In the manual, it states that
both are similar (but not the same), urlencode will encode spaces into '+'
wherelse rawurlencode does not.

Hence, in my below purposes, which should I be using?

It would probably be better to pass the actual column names instead of 
the alias.


As for the above comment, I don't believe that I can as I'm actually using
the SQL statement to put the alias and getting the alias to be spitted out
using mysql_field_result.

But I'm open to how to make the code better.. ideas?..


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2003 7:17 PM
To: Ow Mun Heng
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] $_GET['sort'] & argument separator


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   Title16 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.
[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

The string with the # character needs to be run through urlencode() or 
rawurlencode(). The # character is making your browser look for a 
bookmark named "&dir=ASC" on the view_set_tracker.php page.

It would probably be better to pass the actual column names instead of 
the alias.

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_GET['sort'] & argument separator

2003-07-28 Thread John W. Holmes
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   Title16 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.
[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
The string with the # character needs to be run through urlencode() or 
rawurlencode(). The # character is making your browser look for a 
bookmark named "&dir=ASC" on the view_set_tracker.php page.

It would probably be better to pass the actual column names instead of 
the alias.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_GET['sort'] & argument separator

2003-07-28 Thread Marek Kilimajer
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   Title16 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


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! 


but it still does not work..


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 ''. $p_string .'';
}
=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


RE: [PHP] $_GET['sort'] & argument separator

2003-07-28 Thread Ow Mun Heng
Nope.. Still does not work..


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-Original Message-
From: Nicholas Robinson [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2003 4:53 PM
To: Ow Mun Heng; [EMAIL PROTECTED]
Subject: Re: [PHP] $_GET['sort'] & argument separator


What happens if you use a non-breaking html space instead? I.e Eval #

HTH

Nick
On Monday 28 Jul 2003 9:06 am, 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   Title16 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
>
> 
> 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!
> 
>
> but it still does not work..
>
> 
> This is how the link looks like
>
http://10.0.0.1/trackit/trackit-2003-07-28/view_set_tracker.php?sort=Eval%2
>0 #&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 ''. $p_string .'';
> }
> =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



Re: [PHP] $_GET['sort'] & argument separator

2003-07-28 Thread Nicholas Robinson
What happens if you use a non-breaking html space instead? I.e Eval #

HTH

Nick
On Monday 28 Jul 2003 9:06 am, 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   Title16 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
>
> 
> 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!
> 
>
> but it still does not work..
>
> 
> This is how the link looks like
> http://10.0.0.1/trackit/trackit-2003-07-28/view_set_tracker.php?sort=Eval%2
>0 #&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 ''. $p_string .'';
> }
> =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