1

I have a table called mytable that contains a row with the following data:

uid: 1 (type: int(10))

email: it is visible as 971f2d23 in phpMyAdmin (type: varbinary(16))

I want to run a SELECT query like that:

$conn->query("SELECT * FROM mytable WHERE email=971f2d23");

but this doesn't return any rows.

I also tried:

$conn->query("SELECT * FROM mytable WHERE email=0x971f2d23");

but still no rows.

Any help would be appreciated.

Thanks!

6
  • 1
    Enclose the value you are searching for with quotes as in '0x971f2d23'. Commented Dec 5, 2018 at 15:14
  • 1
    that would mean a string "0x971f2d23" @Dave Commented Dec 5, 2018 at 15:16
  • But that should still work/apply with a varbinary column no? Commented Dec 5, 2018 at 15:18
  • @Dave See the hexadecimal literals documentation. Commented Dec 5, 2018 at 16:36
  • 1
    Thanks @tadman ... learn something new every day (which is a good thing). Commented Dec 5, 2018 at 16:40

1 Answer 1

1

Try this

$conn->query("SELECT * FROM mytable WHERE email='971f2d23'");
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.