Dynadot

Need help in MySQL and PHP

Spaceship Spaceship
Watch

TheWatcher

Founder, MAJ.comTop Member
Impact
992
I have a field name contentdata with a hex data of AA560D72DA4AB20AAA using a type char.

In MySQL, I can run this command:
SELECT SUBSTR(hex(contentdata),15,2) FROM table1

the output is:
0A

How can I code "SELECT SUBSTR(hex(contentdata),15,2) FROM table1" in PHP so I can bring the same result.

MySQL create php code gave me this recommendation but I can't show the value.
$sql = "SELECT SUBSTR(hex(payload),15,2) FROM device_status LIMIT"

Let me know what I'm missing here?
Thanks in advance.

Em

---------- Post added at 11:14 AM ---------- Previous post was at 09:58 AM ----------

I've got the solution, add "AS hex_value" courtesy by Katherine.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back