Page 1 of 1

help with changing php's datatype

Posted: Tue Aug 18, 2009 2:50 pm
by ese7
Hello everyone,

I downloaded this nice script for managing students' grades and did some modification and it's working perfectly except for the fact that the "Students ID' field accepts only figures, however, the students' IDs contain both figures and letters. For example, it accepts student IDs such as "1234" and not "MS1234". Now, I know that this has something to do with the datatype but the code is so intertwined that I can't even pinpoint where the datatype for the students' ID column was declared. Please I desperately heed help here.

Re: help with changing php's datatype

Posted: Tue Aug 18, 2009 4:00 pm
by Darhazer
Most likely the datatype is in the database, not in the PHP code, since PHP is dynamically-typed language. Using any database management tool (MySQL query browser, phpMyAdmin, in case it's uses MySQL database), you can change the type using the GUI.

Re: help with changing php's datatype

Posted: Wed Aug 19, 2009 3:29 am
by ese7
That's exactly what I thought, and I've done that. However, the student ID inserts into that database when you add student but when trying to login, it returns an 'invalid Student ID' error, even if the data is in the database. So I think the datatype for that particular field (Student ID) was declared somewhere in the code, perhaps in the login section but I cant seem to find where.

Re: help with changing php's datatype

Posted: Wed Aug 19, 2009 4:20 am
by Mark Baker
ese7 wrote:That's exactly what I thought, and I've done that. However, the student ID inserts into that database when you add student but when trying to login, it returns an 'invalid Student ID' error, even if the data is in the database. So I think the datatype for that particular field (Student ID) was declared somewhere in the code, perhaps in the login section but I cant seem to find where.
The datatype can't be declared and enforced, but the input can be validated to ensure that it matches a certain pattern (e.g. numeric). It's likely that somewhere in the code it's validating your inputs