yes, it does matter, the ID fields must be integers.
in the orders table, the ID field needs to also be set to auto increment.
The code uses mysql_insert_id(); to look up the auto increment value when the record is inserted.
if you have the ID column set to varchar, it wont be able to auto increment, it needs to be an integer to be able to auto increment.