By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,746 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,746 IT Pros & Developers. It's quick & easy.

LIKE ???

P: n/a
Hello guys, i would need some help here...
I am new to PHP and SQL so please, be patient!
I have a search string which is like that:

$searchstring="SELECT * FROM pelatologio where pelatologio.name LIKE
'%$name%' ;

I get results only when the first character matches the variable...
Well, that was a nonsense sentence....
Lets say, the name field in the database = "Home"
If i search "home" i get No results
but if i search "Ho" i get results!

As i understand, this has to do something with the capitalization...
Can anyone help me?
Thanx in advance!
JBK
Aug 20 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Aug 20, 5:48 pm, <j...@spotter.grwrote:
Hello guys, i would need some help here...
I am new to PHP and SQL so please, be patient!
I have a search string which is like that:

$searchstring="SELECT * FROM pelatologio where pelatologio.name LIKE
'%$name%' ;

I get results only when the first character matches the variable...
Well, that was a nonsense sentence....
Lets say, the name field in the database = "Home"
If i search "home" i get No results
but if i search "Ho" i get results!

As i understand, this has to do something with the capitalization...

Can anyone help me?
Thanx in advance!
JBK
Yes, thats a capitalization problem.
If you say what's your database and of which version, can help to
solve your question.
Aug 20 '08 #2

P: n/a
jb*@spotter.gr wrote:
Hello guys, i would need some help here...
I am new to PHP and SQL so please, be patient!
I have a search string which is like that:

$searchstring="SELECT * FROM pelatologio where pelatologio.name LIKE
'%$name%' ;

I get results only when the first character matches the variable...
Well, that was a nonsense sentence....
Lets say, the name field in the database = "Home"
If i search "home" i get No results
but if i search "Ho" i get results!

As i understand, this has to do something with the capitalization...
Can anyone help me?
Thanx in advance!
JBK
comp.database.mysql is >>that-away.

This is a PHP newsgroup (hence the 'php' in its name).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 20 '08 #3

P: n/a
First of all, thanx for your replies...

Jerry, consider having a database which already has more than 6000 entries
which CANT be modified they have to stay like that... so it actually becomes
more a php thing than an SQL... and i know the excistence of many SQL
groups... but thanx anyway...

I think now, i can make it work as i want it to!

Thanx guys!

<jb*@spotter.gr
news:g8***********@ulysses.noc.ntua.gr...
Hello guys, i would need some help here...
I am new to PHP and SQL so please, be patient!
I have a search string which is like that:

$searchstring="SELECT * FROM pelatologio where pelatologio.name LIKE
'%$name%' ;

I get results only when the first character matches the variable...
Well, that was a nonsense sentence....
Lets say, the name field in the database = "Home"
If i search "home" i get No results
but if i search "Ho" i get results!

As i understand, this has to do something with the capitalization...
Can anyone help me?
Thanx in advance!
JBK

Aug 21 '08 #4

P: n/a
jb*@spotter.gr wrote:
First of all, thanx for your replies...

Jerry, consider having a database which already has more than 6000 entries
which CANT be modified they have to stay like that... so it actually becomes
more a php thing than an SQL... and i know the excistence of many SQL
groups... but thanx anyway...

I think now, i can make it work as i want it to!

Thanx guys!

<jb*@spotter.gr
news:g8***********@ulysses.noc.ntua.gr...
>Hello guys, i would need some help here...
I am new to PHP and SQL so please, be patient!
I have a search string which is like that:

$searchstring="SELECT * FROM pelatologio where pelatologio.name LIKE
'%$name%' ;

I get results only when the first character matches the variable...
Well, that was a nonsense sentence....
Lets say, the name field in the database = "Home"
If i search "home" i get No results
but if i search "Ho" i get results!

As i understand, this has to do something with the capitalization...
Can anyone help me?
Thanx in advance!
JBK


Not in this newsgroup. Whether you can change the database or not is
immaterial. This is not a PHP question - it is a MySQL one.

Here's a hint for you - you're asking about a SQL statement, not PHP
code. PHP knows nothing about SQL.

Get in the correct newsgroup and you'll get help.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 21 '08 #5

P: n/a
..oO(<jb*@spotter.gr>)
>First of all, thanx for your replies...

Jerry, consider having a database which already has more than 6000 entries
which CANT be modified they have to stay like that... so it actually becomes
more a php thing than an SQL...
No. You can and should solve this in SQL either by fixing your query or
your table structure. But you didn't gave enough details about your used
DBMS and the table structure.

Micha
Aug 21 '08 #6

P: n/a
Michael Fesser wrote:
.oO(<jb*@spotter.gr>)
>First of all, thanx for your replies...

Jerry, consider having a database which already has more than 6000 entries
which CANT be modified they have to stay like that... so it actually becomes
more a php thing than an SQL...

No. You can and should solve this in SQL either by fixing your query or
your table structure. But you didn't gave enough details about your used
DBMS and the table structure.

Micha
Or even better, go next door to the the SQL NG. Something like
comp.databases.mysql IMHO

You will get more solutions to your particular problem.
Aug 21 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.