Re: [PHP-DB] PHP/MySQL Question

2001-11-19 Thread RNie

Look at the MySQL manual that came along with it when you downloaded it:

manual.html#String_comparison_functions

or

manual.html#Comparison_Operators

May be that helps you.

René
www.comunica2.net




-- 
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]




RE: [PHP-DB] PHP/MySQL Question

2001-11-12 Thread Rick Emery

SELECT * FROM messages WHERE userID NOT LIKE  '%$userid%'

-Original Message-
From: Peter Brown [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 11, 2001 11:28 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] PHP/MySQL Question


HI, 

New to PHP/MySQL,

I was wondering if this was possible.

I have a users database with an auto-incremented userID field.

I have another message database (it's a message board database) - one of
the fields is a TEXT field with userIDs separated by carriage returns;
eg; if on one record userID 2 and userID 4 have both viewd that record,
the data in that field will look as follows:

2
4

I want to construct a SQL query for every user that logs in (I am
storing their userID as a session variable) so that I can filter out any
messages where a user has already viewed that record.  So in the above
example that record should be filtered out if user 2 or user 4 has
viewed the record.

The query I constructed is:

SELECT * FROM messages WHERE userID != '$userid'

But this will not filter out any records like the one above where the
userID in the message database is separaed by carriage returns as above
(ie; it won't filter out messages for user 2 or user 4).

Hope this makes sense
Peter


-- 
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 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] PHP/MySQL Question

2001-11-11 Thread Peter Brown

HI, 

New to PHP/MySQL,

I was wondering if this was possible.

I have a users database with an auto-incremented userID field.

I have another message database (it's a message board database) - one of
the fields is a TEXT field with userIDs separated by carriage returns;
eg; if on one record userID 2 and userID 4 have both viewd that record,
the data in that field will look as follows:

2
4

I want to construct a SQL query for every user that logs in (I am
storing their userID as a session variable) so that I can filter out any
messages where a user has already viewed that record.  So in the above
example that record should be filtered out if user 2 or user 4 has
viewed the record.

The query I constructed is:

SELECT * FROM messages WHERE userID != '$userid'

But this will not filter out any records like the one above where the
userID in the message database is separaed by carriage returns as above
(ie; it won't filter out messages for user 2 or user 4).

Hope this makes sense
Peter


-- 
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]