Okay, I THINK this is a PHP question...
I've been mucking with PHP for awhile now, but just recently I've been
poking at some ajax stuff, and I ran into something confusing; my
Queries were coming back case-sensitive.
I.e. WHERE user_name LIKE 'd%' would return "david" but not "Daryl"
That's weirding me out- I thought sql queries were case-insensitive by
default. (Admittedly, I haven't done much work with the kind of user-
input data where that'd ever be a problem.)
The equivalent mysqli query seems to be case insensitive- but I think
it's doing some sort of automatic collation thing... and my
destination server lacks mysqli.
....what's going on? Am I tripping on some sort of base-level thing I
just haven't run into before because I so seldom use LIKE, or is this
actually... odd? All the references I find say this sort of query is
supposed to be case-insensitive... :(
PHP 5.2.5
confused,
-Derik 6 4438
..oO(Derik)
>Okay, I THINK this is a PHP question...
I beg to differ. There's not even a single line of PHP code here.
>I've been mucking with PHP for awhile now, but just recently I've been poking at some ajax stuff, and I ran into something confusing; my Queries were coming back case-sensitive.
I.e. WHERE user_name LIKE 'd%' would return "david" but not "Daryl"
What happens if you execute the same query on the MySQL command line?
>That's weirding me out- I thought sql queries were case-insensitive by default. (Admittedly, I haven't done much work with the kind of user- input data where that'd ever be a problem.)
The equivalent mysqli query seems to be case insensitive- but I think it's doing some sort of automatic collation thing... and my destination server lacks mysqli.
The 'i' in mysqli doesn't mean case-insensitive. It's a completely
different database interface (an 'i'mproved one). Finally it's always
the DBMS that executes the query, regardless of the used interface and
PHP version.
So either ask again in <news:comp.databases.mysqlor post some more
details (and PHP code!) about what you're trying to do. The part of the
query above doesn't tell much and works as expected here.
Micha
Derik wrote:
Okay, I THINK this is a PHP question...
I've been mucking with PHP for awhile now, but just recently I've been
poking at some ajax stuff, and I ran into something confusing; my
Queries were coming back case-sensitive.
I.e. WHERE user_name LIKE 'd%' would return "david" but not "Daryl"
That's weirding me out- I thought sql queries were case-insensitive by
default. (Admittedly, I haven't done much work with the kind of user-
input data where that'd ever be a problem.)
The equivalent mysqli query seems to be case insensitive- but I think
it's doing some sort of automatic collation thing... and my
destination server lacks mysqli.
...what's going on? Am I tripping on some sort of base-level thing I
just haven't run into before because I so seldom use LIKE, or is this
actually... odd? All the references I find say this sort of query is
supposed to be case-insensitive... :(
PHP 5.2.5
confused,
-Derik
This is a sql, not a php question. However, to answer you, putting in
field names is case insensitive. However, "Dog" is not the same as
"dog". The like command tries to match in a case-sensitive manner. If
you want them all you could have your where clause as being something
similar to toupper(user_name) LIKE 'D%'. That would return both
'david' and 'Daryl'.
..oO(sheldonlg)
>This is a sql, not a php question. However, to answer you, putting in field names is case insensitive. However, "Dog" is not the same as "dog". The like command tries to match in a case-sensitive manner.
Nope. From the manual:
| SQL pattern matching allows you to use “_” to match any single
| character and “%” to match an arbitrary number of characters
| (including zero characters). In MySQL, SQL patterns are
| case-insensitive by default.
There are some cases where the comparison is done in a case-sensitive
way, but the OP didn't post enough details.
Micha
Michael Fesser wrote:
.oO(sheldonlg)
>This is a sql, not a php question. However, to answer you, putting in field names is case insensitive. However, "Dog" is not the same as "dog". The like command tries to match in a case-sensitive manner.
Nope. From the manual:
| SQL pattern matching allows you to use “_” to match any single
| character and “%” to match an arbitrary number of characters
| (including zero characters). In MySQL, SQL patterns are
| case-insensitive by default.
There are some cases where the comparison is done in a case-sensitive
way, but the OP didn't post enough details.
Micha
Yes, depending on several things, it might be case sensitive or not.
But that should be discussed in comp.databases.mysql, not here.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
..oO(Jerry Stuckle)
>Yes, depending on several things, it might be case sensitive or not.
But that should be discussed in comp.databases.mysql, not here.
ACK
Micha
On Jul 15, 1:44 am, Derik <ReGenes...@aol.comwrote:
Okay, I THINK this is a PHP question...
I've been mucking with PHP for awhile now, but just recently I've been
poking at some ajax stuff, and I ran into something confusing; my
Queries were coming back case-sensitive.
I.e. WHERE user_name LIKE 'd%' would return "david" but not "Daryl"
That's weirding me out- I thought sql queries were case-insensitive by
default. (Admittedly, I haven't done much work with the kind of user-
input data where that'd ever be a problem.)
The equivalent mysqli query seems to be case insensitive- but I think
it's doing some sort of automatic collation thing... and my
destination server lacks mysqli.
...what's going on? Am I tripping on some sort of base-level thing I
just haven't run into before because I so seldom use LIKE, or is this
actually... odd? All the references I find say this sort of query is
supposed to be case-insensitive... :(
PHP 5.2.5
confused,
-Derik
Use username and password columns as binary, so it would be case
sensitive.. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris |
last post by:
Hello all.
I'm currently working on a new site that encompasses the registration
of members. The registration is taking place through PHP interaction
with MySQL. The site is just going to be...
|
by: lkrubner |
last post by:
If I make this query with MySql:
SELECT * WHERE keyword='urbanism'
is the comparison case insensitive? Will MySql return all rows where
keyword equals both 'urbanism' and 'Urbanism'?
I...
|
by: Elliot Temple |
last post by:
Hi I have two questions. Could someone explain to me why Python is
case sensitive? I find that annoying. Also, why aren't there
multiline comments? Would adding them cause a problem of some...
|
by: vncntj |
last post by:
I'm trying to get the venue in the 'List' column when in contains a
value. But if the venue Is Null then place the event in the 'List'
SELECT
CASE
WHEN event Is Null THEN venue
Else
event...
|
by: Randy |
last post by:
Folks:
We have a web-based app that's _really_ slowing down because multiple
clients are writing their own private data into a single, central
database. I guess the previous programmer did...
| |
by: Sophisticado |
last post by:
Greetings
I have a script in which I am collecting sensitive information via a
form (METHOD=POST) and encrypting the posted variable (format = BLOB)
using mcrypt, then saving it in a MySql...
|
by: e_matthes |
last post by:
Hello,
I am developing on a windows machine, and hosting on a linux server.
I have written my php code using table names like siteStats and column
names like userStatus. I have just realized...
|
by: srinivembu |
last post by:
Hi,
I am trying to port my application from SQLite to MySQL database. I believe MySQL by default searches string in case insensitive manner while using '=' and 'like' operators in SELECT...
|
by: ssnaik84 |
last post by:
Hi Guys,
Last year I got a chance to work with R&D team, which was working on DB scripts conversion..
Though there is migration tool available, it converts only tables and constraints..
Rest of...
|
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...
|
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,...
| |
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...
|
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...
|
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 projectplanning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |