Is it safe to create manual primary keys (non-autoincremental). I want to use php
$id = timestamp("now");
and set that as value of the primary key.
Why ?
Because i'm trying to insert multiple records say 100 in a table with LOAD DATA INFILE but the problem is that tables in my database have relationships and i don't know hot to get the primary key value of parent table and insert it as foreign key in child table.
My idea is to save manual value for primary key and use it in another insert as foreign key. First, tell me if im safe to use my method, then practical solution with LOAD DATA INFILE would be great. Thanks !
Edit : As stated in the comments, i think some do not understand the nature of my problem. I use PDO and i know how to get lastInsertId() and set it as foreign key in child table. The problem is i collect big data and i don't insert in a loop or whatsoever. Please understand the problem then try to comment or earn points, be helpful. If my approach is not safe, then give a solution or a reference and explain how would i insert big data in multiple tables with LOAD DATA INFILE while maintaining relationships.