473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

LIKE ???

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
6 1192
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
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
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
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
..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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: tomek | last post by:
What should I write after sql like for finding hole words and not for words in string sequence. I tryied "like space variable space" but it's not working for me. Database is MYSQL.
1
by: Mooky Mooksgill | last post by:
I would like to search a table for a phrase, or for a partial phrase, eg on table product - for name or description, or name + descprition. How does one say select * from product where name +...
7
by: Michael Beumers | last post by:
Hello NG I've defined a cursor like the following in my COBOL Programm: DECLARE testc CURSOR FOR SELECT ... FROM ... WHERE field1 LIKE :hostvariable1 field2 LIKE :hostvariable2
4
by: Tom Walker | last post by:
I cannot get the WHERE statement to work correctly unless I use a literal with the LIKE. I want to use a working storage data name so that I can vary the WHERE statement. Example that works: ...
5
by: Steve | last post by:
Hello, I currently have a query that takes it's criteria from a form. All works well except when a name is mis-spelled in the database. My thought was to try to use the "like" command as part of...
11
by: ynott | last post by:
Novice here obviously. Anyway, I'm a bit confused about how to approach this. I have a query against a table that I'm trying to create. I'm trying to view all streets.type values that are null,...
9
by: Nathan Sokalski | last post by:
I am trying to do a database search using LIKE using the following code: Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click If...
2
by: Ed Brown | last post by:
I'm working on a VB.Net application that needs to do quite a bit of string pattern matching, and am having problems using the "LIKE" operator to match the same string twice in the pattern. For...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
11
by: Dan Sugalski | last post by:
Is there any good way to speed up SQL that uses like and has placeholders? Here's the scoop. I've got a system that uses a lot of pre-generated SQL with placeholders in it. At runtime these SQL...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.