Jump to content

PHP\MySQL Query to set field to 1 if search flags not found in upper(descr)


Recommended Posts

Hi, I am having a very hard time debugging & running the following query from a cell on php or pma.

$sql = "UPDATE crypto SET crypto_openssl_recommendation = 1 WHERE (\"%ECB%\" OR \"%RC2%\" OR \"%RC4%\" OR \"%DES%\" OR \"%3DES%\" OR \"%MD5%\") LIKE UPPER(crypto_descr);";

The table is meant to keep track of OpenSSL encryption methods, and their availability and recommendation over CryptoJS wether used in Javascript, or JScript. This query is meant to update the recommendation, but the quality of my MySQL querying has wilted a bit in the past four years.

Edited by Greywacke
Expanding on clarity
Link to comment
Share on other sites

You need to explicitly list each comparison.

UPDATE crypto SET crypto_openssl_recommendation = 1 WHERE "%ECB%" LIKE UPPER(crypto_descr) OR "%RC2%" LIKE UPPER(crypto_descr) OR "%RC4%" LIKE UPPER(crypto_descr)...

If your character set is case-insensitive then you don't need to cast to uppercase.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...