Jump to content
php.lv forumi

Lielie un mazie burti


djmartins

Recommended Posts

Kādā veidā es varētu panākt, lai ierakstot meklētājā kādu vārdu netiktu ņemti vērā lielie un mazie burti? Rezultātu izvadītu jebkurā gadijumā.

SELECT * FROM tabulis WHERE kur_meklet LIKE 'KoMeklEEt'

Atribuuts LIKE bez % njems konkretu vardu/frazi ignorejot Uper/Lover

Link to comment
Share on other sites

Hmm, vai tad to, kā notiek meklēšana nenosaka tabulas kolācija .._ci ?

nosaciti.. kolacija nosaka kartoshanu (pec konkretas valoadas ipatnibam/alfabeta )

itkaa jau MySQl arii Wrchar tipam izmantojot = ipashi netiek njemts vera Up/lov..

bet ta ka nebi noradiita kada Db etc.. tad ieteicu LIKE

vel ir varjants abus parverst Vai nu agseja vai apakseja registra

Stipri aptuveni shadi

SELECT * FROM tabulis WHERE settouper(lauks_kur mekle)=settouper('meklejama_vieniba')

P.S. netceros no galvas f-jas nosaukumu ...

Edited by Grey_Wolf
Link to comment
Share on other sites

WRCHAR un TEXT laukiem netiek njemta vera Up/Lov Ja vien Ipashi tas netiek paprasiits kolicija _bin

Defolta tiek izmantota _CI kas nenjem vera lielos mazos burtus ....

bet gan vairak pieversas Kartosanas secibai

--

marcis -> starp citu tas arii ir uzradiits tava linkaa ;)

Edit:

savulaik mekletajam taisiju shadu f-ju, kas ljau izmantot userim ierasto * % vieta

--

function sql_like($strings)
{
 $strings=preg_replace("@[\']@m","\'",$strings); 
 if(mb_stripos($strings,'*')!==false OR mb_stripos($strings,'?')!==false)
 {
   $strings=preg_replace('@[_]@m','\_',$strings); // nomaina uz %
   $strings=preg_replace('@[%]@m','\%',$strings); // nomaina uz %
   $strings=preg_replace('@[?]+@m','_',$strings); // izmet tuksumus
   $strings=preg_replace('@[*]+@m','%',$strings); // nomaina uz %
   $strings =" LIKE '".$strings."' ";
 }
 else
 {
   $strings =" ='".$strings."' ";
 }
return $strings;
}

---

Dota f-ja nomaina * un ? uz % un attiecigi izvelas vai = vai LIKE

jo teoretiski = stradaa atrak nekaa LIKE

Edited by Grey_Wolf
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...