badeand Posted November 25, 2012 Share Posted November 25, 2012 (edited) Hi, I´m making a system that´s is meant to store information about some hardware and the different kind of error messages and fault that appears on the hardware. Each hardware has is it`s own unique hardware ID and it`s the last 4 digits in the Hardware ID ( serial number). Is there a way that i can detect wich hardware this is by making the php script looking for the 4 last digits in the serial and lookup this in a mysql table (that contains the different equipment and information about this) and pick the right equipment and then redirect to the right error handling page with the specified form for this equipment? Each equipment has it own error messages and known errors, so one error (form) for each equipment is needed. Edited November 25, 2012 by badeand Quote Link to comment https://forums.phpfreaks.com/topic/271151-detect-hardware-by-hw-id/ Share on other sites More sharing options...
JD* Posted November 25, 2012 Share Posted November 25, 2012 Do you want to make it automatically detect the serial number? Or is it a form that the person fills out? If it's the former, you'll need to involve some javascript. If it's the latter, you can grab the last four digits of the submitted serial number and then do a query. Try looking at substr. You can tell it to start at the strlen($serial) - 4 and then use that to query your database. Quote Link to comment https://forums.phpfreaks.com/topic/271151-detect-hardware-by-hw-id/#findComment-1395008 Share on other sites More sharing options...
Christian F. Posted November 26, 2012 Share Posted November 26, 2012 No need to use strlen (), substr () accepts negative values for the start position. The PHP manual will explain it in more detail. Quote Link to comment https://forums.phpfreaks.com/topic/271151-detect-hardware-by-hw-id/#findComment-1395180 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.