pctechtime Posted January 12, 2007 Share Posted January 12, 2007 I am trying to input a string of numbers and have it go into 4 different fields of a database. See belowAny help would be great. data to input 0215446912345678scan_field // this is the field the above number would go into and also needs to be broken up into the fields belowitem_number // this is the field the first 6 numbers would go intograde // this is the field the next 2 numbers would go intoserial_number // this is the field the last numbers would go into (the last set of numbers can be 1 to many in length Quote Link to comment Share on other sites More sharing options...
kobmat Posted January 12, 2007 Share Posted January 12, 2007 You may want to look into the substr function on php documentation Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 12, 2007 Share Posted January 12, 2007 This:[code]<?php$input = "0215446912345678";$scan_field = $input;$item_number = substr($input, 0, 6);$grade = substr($input, 6, 2);$serial_number = substr($input, 8);echo "Scan Field: " . $scan_field . "<br>";echo "Item number: " . $item_number . "<br>";echo "Grade: " . $grade . "<br>";echo "Serial number: " . $serial_number . "<br>";?>[/code]Produces this:[code]Scan Field: 0215446912345678Item number: 021544Grade: 69Serial number: 12345678[code][/code][/code] Quote Link to comment Share on other sites More sharing options...
pctechtime Posted January 12, 2007 Author Share Posted January 12, 2007 This is great thank you so much Quote Link to comment 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.