Skip to main content

Using SELECT SUBSTR - MySQL PHP

I've got to re-learn my MySQL and PHP programming skills.

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
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?

UPDATE:
A member (Katherine) in domain name forum recommended to use "AS hex_value" to create aliases for the field resulting from expressions. It works!

So, I query the data using the codes below:
"SELECT SUBSTR(hex(contentdata),15,2) AS myHex_data FROM table1"


Popular posts from this blog

Alternative Social Networks

If you are planning to create your social network e.g. similar to Facebook. Here's a short list of alternative software's:

Open Source and Free​
http://buddypress.org/ - Wordpress (Open Source and Free)http://elgg.org/ - (Open Source and Free)Commercial Social Networks software
http://www.socialengine.com/ ($299 Stand Alone, $29/mo Cloud)http://www.jomsocial.com/ (run with Joomla, need to know CMS)http://www.boonex.com/ (very expensive, $399 for Standard)http://www.anahitapolis.com/http://www.oxwall.org/http://sharetronix.com/http://www.moosocial.com/http://www.jcow.net/http://phpdolphin.comhttp://www.grou.ps (from free to Commercial, I left my networks and they are selling it http://www.phpfox.com/ (I used this before, it's hard to maintain. I moved to NING but left too after it was sold to another company)http://www.ning.com (I don't recommend using this service, it's hard to export your data when it's time to move)Something to check when selecting your next soc…

Frequent Account Lockout in Active Directory

I have a user in Windows Pro 7, and Windows Server 2003 environment that is frequently account locked out. I tried many different scenarios to resolve this account lockout issue, from resetting his password, changing a new password, remove and re-join the domain, rebooting the workstation and active directory servers.

I tried to use the command prompt utility to run "rundll32.exe keymgrdll, KRShowKeyMgr" (case sensitive) to delete the account in Windows 7 password cache, and still no luck.

Still searching for answer ... Let me know if you encounter a similar issue in Windows Pro 7 and Windows Server 2003.

Continue reading updated post here:
http://www.whaddya.com/2011/09/windows-needs-your-credentials.html

Example of Out of Office Reply for Terminated Employee

This is a sample message that I used for terminated employees, unless HR staff specified a different message.
=== Example for KING.NET Employee === John Doe (employee or consultant) is no longer with KING.NET effective June 1, 2008 (termination date). For matters relating to "Project Name here" please direct your concerns to John Smith at johnsmith@king.net (Manager or Supervisor). For all other matters, please direct your email to Mary Smith HR at marysmith@king.net.
Please call our main office 703-345-6789 if you have other concerns.
Thank you.
=== end of message ===