Jump to content


Photo

Search DB.


  • Please log in to reply
2 replies to this topic

#1 shenniko

shenniko
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 February 2006 - 01:31 PM

Hi Guys need a little help,

Pretty new to MySQL and PHP, as i started learing ASP thought Access DB's...

Ive created a sort of search function for my members section, so you can search by Username..

How do you create a "LIKE" statement?

E.g say i enter Da into the search box, it will bring Everything back with "Da" in the database?

All i need is the

WHERE tblCharacter.Character LIKE '$Character'";

Or whatever the code is.

thanks in advance

shenn

#2 mshallop

mshallop
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 February 2006 - 03:30 PM

[!--quoteo(post=344455:date=Feb 10 2006, 05:31 AM:name=shenniko)--][div class=\'quotetop\']QUOTE(shenniko @ Feb 10 2006, 05:31 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi Guys need a little help,

Pretty new to MySQL and PHP, as i started learing ASP thought Access DB's...

Ive created a sort of search function for my members section, so you can search by Username..

How do you create a "LIKE" statement?

E.g say i enter Da into the search box, it will bring Everything back with "Da" in the database?

All i need is the

WHERE tblCharacter.Character LIKE '$Character'";

Or whatever the code is.

thanks in advance

shenn
[/quote]

WHERE tblCharacter.Character LIKE '%$Character%'";

if $Character == "da" and this is being submitted from somescript.php...

--Mike

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 February 2006 - 07:51 PM

If you are doing this often, you many want to consider using a FULLTEXT index.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users