This isn't the same piece of code, either. The code you posted was for
creating a piece of HTML code for an <A HREF=...> containing the variable
$sort.
The code you're showing us now is for a MySQL query. MySQL is looking for
the characters %20, not a space, in the field you're searching through.
That's why the query comes up empty.
So, basically you would do this:
if ($sort == "") {$sort = "id DESC";}
$querystring = $querystring." ORDER BY $sort";
$result = mysql_query("$querystring;",$link);
$num_rows = mysql_num_rows($result);
$sort = urlencode($sort);
if ($page_num != $total_num_page){print " <a
ref=\"./propview.php?$guidestring&cur_page=$nextpage&sort=$sort\">Next
Page</a>
The %20 will only appear in the link, not in the query.
- Jonathan
-----Original Message-----
From: Paul Markov [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 8:56 AM
To: Jonathan Hilgeman; 'Don Read'
Subject: Re: Netscape ignores %20 with $sort="id DESC"
Jonathan,
Thanks for the tip... I thought it was going to work, but I got this error:
"Supplied argument is not a valid MySQL result resource in...." (point
exactly at $sort = urlencode($sort); )
By just using "id+DESC" I also get the "Supplied argument is not a valid
MySQL result resource ". Here's a little more of the code - anything to do
with the { } brackets?
if ($sort == "") {$sort = "id DESC";}
$sort = urlencode($sort);
$querystring = $querystring." ORDER BY $sort";
$result = mysql_query("$querystring;",$link);
$num_rows = mysql_num_rows($result);
Thanks again for your help!
Paul.
----- Original Message -----
From: "Jonathan Hilgeman" <[EMAIL PROTECTED]>
To: "'Don Read'" <[EMAIL PROTECTED]>; "Paul Markov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, December 03, 2001 11:17 AM
Subject: RE: Netscape ignores %20 with $sort="id DESC"
> Try adding a line right below $sort:
> $sort = urlencode($sort);
>
> It should add the %20s for you.
>
> - Jonathan
>
> -----Original Message-----
> From: Don Read [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, December 02, 2001 8:35 PM
> To: Paul Markov
> Cc: [EMAIL PROTECTED]
> Subject: RE: Netscape ignores %20 with $sort="id DESC"
>
>
>
> On 02-Dec-2001 Paul Markov wrote:
> > Hi,
> > some users of my web are having problems with sorting a MySQL table
> > because older
> > versions of Netscape do not recognize a blank space and do not convert
> > it into a %20.
> >
> > Here's my situation:
> > $sort = "id DESC"
> > if ($page_num != $total_num_page){print " <a
> > ref=\"./propview.php?$guidestring&cur_page=$nextpage&sort=$sort\">Next
> > Page</a>
> >
> > Netscape drops "DESC" because it can't convert the blank space into a
> > %20. (this works fine with newer versions of Netscape. Internet
> > Explorer does not have such a problem).
> >
> > Is there a workaround for this problem?
>
> The '%20' is correct by current standards. For backwards compatibilty, you
> can try a plus sign 'id+DESC' (be aware that this is now the "wrong" way
to
> do it).
>
> Regards,
> --
> Don Read [EMAIL PROTECTED]
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.
> (53kr33t w0rdz: sql table query)
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php