[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Netscape ignores %20 with $sort="id DESC"


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:pmarkov@xxxxxxx]
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" <JHilgeman@xxxxxxx>
To: "'Don Read'" <dread@xxxxxxxxx>; "Paul Markov" <pmarkov@xxxxxxx>
Cc: <mysql@xxxxxxxxxxxxxxx>
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:dread@xxxxxxxxx]
> Sent: Sunday, December 02, 2001 8:35 PM
> To: Paul Markov
> Cc: mysql@xxxxxxxxxxxxxxx
> 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                                       dread@xxxxxxxxx
> -- 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 <mysql-thread92880@xxxxxxxxxxxxxxx>
> To unsubscribe, e-mail
<mysql-unsubscribe-JHilgeman=ecx.com@xxxxxxxxxxxxxxx>
> 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 <mysql-thread92912@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.