title: how to set foreign keys in tables using mysql and php?
body: <p>I have two tables called location and donor. the location table has a foreign key references to donor. 
  I want to insert the data into these tables using mysql so I wrote these queries but I think there is something wrong because I have no data inserted: </p>
  
  <pre><code>$sql = "INSERT INTO  donor(firstname,middlename,lastname,age,bloodgroup,phone,email,weight,height,pas sword,sex,national_number,permission)
                 VALUES  ('$user','$mname','$lname','$age','$bloodgroup','$phone','$email','$weight','$he ight', '$password','$sex', '$national_number','$permission')";
  
  
  while($vr = mysql_fetch_object($sql))
  {$id=mysql_query("SELECT id FROM donor WHERE id=$vr-&gt;id")};
  $update = mysql_query("INSERT INTO location (id,longitude,latitude) VALUES  ('$id','$long','$lat')");
  </code></pre>