PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 15, 2022

[FIXED] MySQL query only works when strings don't contain numbers

 January 15, 2022     mamp, mysql     No comments   

Issue

Ok so the query is really simple:

SELECT a, b, c FROM d WHERE a = ('x' OR 'y' OR 'z');

And that query works great, but if I were to query say, this:

SELECT a, b, c FROM d WHERE a = ('x' OR 'y' OR 'z' OR 'x1');

No rows would be returned because of the number in 'x1'.

I'm using mysql 5.5.9, and I'm running a virtual server on my mac using MAMP (if it matters)

Thanks for the help guys!


Solution

Try these

SELECT a, b, c FROM d WHERE a IN ('x','y','z','x1');

OR

SELECT a, b, c FROM d 
WHERE a = 'x' OR a = 'y' OR a = 'z' OR a = 'x1';


Answered By - codingbiz
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing