Re: [PHP-DB] How to make it case sensitive?

2001-09-21 Thread David Bullock

On Fri, 21 Sep 2001 14:28:52 -0400, [EMAIL PROTECTED] (Jason Stechschulte)
wrote:

On Fri, Sep 21, 2001 at 05:02:14PM +0100, Denny Suvanto wrote:
 The script is just fine until I notice that the
 username is case insensitive. So, if a member has a
 username andy he can log in using 
 andy, Andy, aNdY, andY, and so on. I also
 notice that I can't enter a new member with username
 Andy, anDY, and so on as they will duplicate the
 existing andy. Is this the natural behaviour of
 MySQL or is there anyway to make it case sensitive?
 I'm using PHP 4.0.6  MySQL 3.23.39.

You have to make the column case sensitive, binary will accomplish this.
Something like:

username varchar(20) binary

Another way to tackle the problem is to store the data into field in a set case
by running strtoupper or strtolower on the data before you store it or retrieve
it.  It will also likely require less CPU power than running a fuzzy regexp
based search.

- Dave

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Escaping

2001-07-12 Thread David Bullock

On Thu, 12 Jul 2001 10:18:23 -0500, [EMAIL PROTECTED] (Randy Rankin)
wrote:

Hello,

I have a table in a MySQL DB (RH Linux/Apache) with a field called
customer_name. Some of the customer names have an ampersand in them (ie; X 
X Supply). I am performing a select statement on this table to create a
sales summary with customer name and total sales.

This works fine; however, I am also creating a dynamic link on the customer
name so that the user can click on it to get a detailed report of sales to
that customer. This works great EXCEPT for the customers with ampersands in
thier names. The result of clicking on these customers indicates a No
Records found for X where X is the letter immediately preceding the
ampersand.

Does anyone know how to get around this?

Would it be practical to link off a unique record_id instead of the noun-name? 

That way you can assure that the data you're passing doesn't have any
URL-unfriendly characters, and you guarantee that the data you're retrieving is
the unique data you're linking from.

Dave

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]