Project / Support Center
Welcome, %1$s. Please login or register. February 28, 2024, 10:33: AM
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  MySQL/PHP  |  : Don't show a record that contain some string or word. 0 and 1 Guest are viewing this topic. « previous next »
: [1]
: Don't show a record that contain some string or word.  ( 11471 )
admin
Administrator
******


: 239


« : November 19, 2019, 03:15: PM »

This I had a tough time doing and although I am sure there is a more "Correct" way to do this this is what finally worked for me after trying NOT CONTAIN, NOT LIKE and others in the where clause.

I had customers enter a fake email for certain people in their list, the email always contained person@noemail.com at the end

To eliminate those records from receiving emails I included in the mysql query the following:

WHERE RIGHT(group.contact_email,11)!='noemail.com'

The green is the table.field and the 11 is the number of characters in the noemail.com string itself.. By adding RIGHT to the expression it is saying count 11 characters from the right side of the field.

!= this means not

So the expression says - count the 11 characters from right side of the field and don't include those in the displaying results
« : November 19, 2019, 03:19: PM admin »  

The Unknown Webmaster
: [1]  
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  MySQL/PHP  |  : Don't show a record that contain some string or word. « previous next »
:  


Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!
Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.