I am trying to create a very custom primary key, example in a [table_1]
having columns tble_id, date_entered, time_entered, card_number, name, address.
I would like to have the primary key (tble_id) to be a combination of the columns: date_entered, time_entered, card_number
. So for example primary key being: 2014082717010001
, in this case 20140827
being the date, 1701
being the time and 00001
being the card number.
Asked
Active
Viewed 30 times
0

dames
- 1,421
- 8
- 35
- 55
1 Answers
0
why don't you make this id a string , separated by commas such as 20140827,1701,0001 therefore when you fetch each id , you can get each of the needed information by using $x=explode(',' , table_id) where you'll get $x[0]=date , $x[1]=time_entered and $x[1]=card_number but all of string type

Att3t
- 466
- 2
- 8
-
ok but I have an exsisting table as well that I want to convert the current ID number into the format Given – dames Aug 28 '14 at 00:16
-
let me get this straight, you want to insert these values in an existing table ? – Att3t Aug 28 '14 at 12:08