Hi all, i am very new to php, this is my first post and the first project that i am working on. i have searched for my problem but i cant find a solution, i suppose i dont even know what im looking for so here goes!

i have a form that is used to post details of a vehicle including an image,
everything is great if i store all if my values into one table.
my problem is that i want to store the image name into a different table so that each vehicle can have multiple images.

what i dont understand is the following:

in the file/page where the following query is held

$query = "INSERT INTO cars (id,  make,  model,  description,  color,  yearmodel,  price,  km,  dealership,  location, date_added)
VALUES ('NULL', '".$make."', '".$model."', '".$desc."', '".$colour."','".$yearmodel."', '".$price."', '', '', '', '')";
mysql_query($query) or die("error".mysql_error());

the above query stores the details of the vehicle into the database table called: cars, and creates a unique ID for the row.

following the above query i want to insert or create a new row in a table called images and insert the name of the image, but i need to associate the image with the car so i thought of adding the unique ID of car row to the image row.

the thing is that i dont know what the ID of the new row is because it was just created and im not sure if i can do another query to find the car row ID on the same page.

if anyone can guide me in the right direction, i will really appreciate it