php - Inserting data into a SQL table but getting a specific column data from another table with different column names -
i looking help,
i have 2 tables, 1 being users , being land. users can have many pieces of land.
my users table holds - id | username | pass land table holds - id | land_id |land_name
i trying create sql statement allow me create new 'land' record populate 'land_id' 'id' users table. therefore:
the user id 1 has land name green has land_id 1 meaning own land?
i hope makes sense.
thank in advance help.
$var = $session_id; //use whatever variable use when collecting session id, gather using unique id users table this. $sql = "insert land (land_id, land_name) values ('$var', '$land_name')"
extra info:
if coming html form can input users session id hidden input:
<input type = "hidden" name="id" value="<?php echo['id']; ?>">
in case define variable as:
$var = $_post['id'];
Comments
Post a Comment