I am new to php. I just got to know about sql injection, and have been thinking of ways to avoid it. One way I could think of is this: If we could hash the username, the password and other details before querying, then we can avoid sql injection completely. So is there a good way to do this? I mean, can we use a hash function to prevent sql injection?
The languages I am familiar with are C and C++. Is there a way to obtain the hex coding of each character entered in the string so that it can be converted to some other type before querying?