i wanna make a project to find a rented house / room user can post his room/house to rent and others can see it on the map
first user should login then he register his location in table location. table location consist id_location, lat, lng, id_user, etc. id_location is auto increment,its primary key. id_user is from session that user logged on, it reads that username, Its foreign key. rest are input by user, i've succeed to make till this point
and the next thing is user gonna pick house or room to rent example; they wanna rent a room. this room table has id_room, id_user,id_location, rate, etc. id_room is auto increment, primary key. id_user is from session that user logged on, so it reads the username. and the problem is for the id_location. how can the database had that id_location from the last location input / location tbl?
Because that a location can have more than 1 room and the type of the room can be different, like it rate, facility, or etc. so i make it several input for each room, then user can creates its own room data for each room but has a same id_location
i mean something like
insert into tbl_room
values (null, '$_SESSION[username]', '$rate','$bla' ,'...','...' ,'...' , )
where id_location from location.id_location
but i know 'where' cant be in input scenario ..
i've read something about select statement but i dont know how that select works in my case, i mean the exact query will be
i hope u r understand about my problem thanks be4