I have a field called StudentID varchar(9) which is a University ID (UID) used on campus. The students enter this on the scantron when they take a test. It is highly likely they will enter the wrong number or maybe only the last 4 of their UID. The scantron is fed into a machine that records the test and spits out a grade.
The format of the csv that I import looks like this.
1,000077193 ,"ABOUSOUD, OMAR ",9,90,35,9,90
1,000390918 ,"ABRAHAM, HEIDI ",9,90,35,9,90
1,000385334 ,"ADAMSHARRISON, ANGELA ",8,80,14,8,80
1,000545516 ,"AGIN, ANNIE ",8,80,14,8,80
1,000388419 ,"AMPONSAH, EUGEN ",10,100,75,10,100
The 9 character number is the StudentID or UID. Sometimes I will see a StudentID in this file as
The lazy student didn't bother putting his whole UID on the scantron and the machine they feed this into places xxx in place of what I assume to be leading zeros.
The accurate UID's stored in my students table looks like this
U00025856
U00020784
U00518132
etc
*Note all of them have a leading capital U followed by 8 characters.
In the imported table from the scantron I need to trim leading x's from the StudentID and replace with zeros, and replace the first character with a U.
Is the following accurate, or am I even in the ballpark?
$alteruid = $db->sql_query("SELECT StudentID FROM ".$prefix."$table_name");
while ($check_UID = $db->sql_fetchrow($alteruid)) {
$new_UID = substr(REPLACE(x '0'($check_UID['StudentID'], -8)));
I still have to append with a capital U.
I didn't think cleansing these scantron records would be so difficult. :glare: