Need help in MySQL and PHP

Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
Watch

TheWatcher

Founder, MAJ.COM QUE.COMTop Member
Impact
1,000
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.
GoDaddyGoDaddy
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Parking: a plain list of your portfolio domains
Your public portfolio page has a new option in the menu next to the sort options. "Domain list" opens a plain page with one domain name...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back