Reply to Re: PHP newbie - % as hex in URL?

Your name:

Reply:


Posted by b on 10/08/05 22:15

Dan wrote:
> Do you want to pass the term directly to mysql from your PHP script? If
> yes, then I don't see any problems. For example, the following should work
> fine:
> $str = "%" . $input . "%s";
> ... and then in the query '... LIKE ("' . mysql_escape_string($str) . '")
> ...'
>
> Bogdan
>
>
> "b" <b@notvalid.ca> wrote in message news:tgS1f.109324$1i.80036@pd7tw2no...
>
>>Hello,
>>
>>I am writing a web based contact relationship program in PHP
>>and MySql,
>>and so far all is well, except passing partial queries based
>>on wildcard
>>characters. For example, if I search on a term like budget,
>>or a partial
>>search with bu as the search term, it works well. Budget
>>will return all
>>records with budget in the requested field and bu will
>>return all records
>>with bu as any part of the search term. Now, if I do a
>>search on Calgary
>>or California, or a partial search such as ca, I get a
>>strange character
>>in the URL instead of the wildcard search.
>>
>>Here is the code I am using for the wildcard based search:
>>
>>if(isset($_GET('newWild')) {
>>$newWild = "%".$_GET['newWild']."%";
>>$wildcard = $newWild;
>>} else {
>>$newWild = "%".$_POST[''searchTerm'];
>>$wildcard = $newWild;
>>}
>>
>>I check to see if newWild is set in the URL for pagination
>>purposes or if
>>not set, then return the query as posted from a form.
>>
>>I then surround the search term with %'s to allow for
>>wildcard searches
>>based on partial searches.
>>
>>I think that because I am surrounding the search term in
>>%'s, PHP is
>>interpreting any valid %## combination as hex
>>representation, such as %20
>>being interpreted as ' space '.
>>
>>How do I pass the actual value instead of having PHP
>>interpret any valid
>>%## combination as a hex representation?
>>
>>For example, a partial search for provinces/states starting
>>with cal, is
>>supposed to be passed as %cal%, but instead, passes as
>><hex>l% in the URL.
>>
>>Forgive the <hex> but I can't reproduce the symbol, (it is
>>like a capitol
>>E with an accent above it).
>>
>>Thanks!
>>
>>Oh, the version of PHP I am using is version 4.4
>
>
>

Doing it the way you suggest is how I am passing it to mysql
once retrieved from the URL, but it is the URL that is
re-formating the query term into the hex equivalent if it
sees a match.

Thanks!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация