I changed the order and it worked. Like this:
$sql_b = "INSERT INTO h_baslik (h_baslik_t) VALUES ('$hbaslik')";
$sql_s = "INSERT INTO h_spot (h_spot_t) VALUES ('$hspot')";
$sql_m = "INSERT INTO h_metin (h_metin_t) VALUES ('$hmetin')";
$sql_r = "INSERT INTO h_resim (h_resim_url) VALUES ('$hresim')";
$conn->exec($sql_b);
$hbaslik_id = $conn->lastInsertId();
$conn->exec($sql_s);
$hspot_id = $conn->lastInsertId();
$conn->exec($sql_m);
$hmetin_id = $conn->lastInsertId();
$conn->exec($sql_r);
$hresim_id = $conn->lastInsertId();
$sql_h = "INSERT INTO haberler (baslik, spot, metin, resim, kat_id, yayin_zamani, onay) VALUES ('$hbaslik_id', '$hspot_id', '$hmetin_id', '$hresim_id', '$hkat', '$htarih', '$honay')";
$conn->exec($sql_h);
here is the code that i tried so many different styles. I want to add news content to e.g. "content" table. News Title to "titles" table. and then i want to get ids' of that records to my "news" table as int value (ids). How can i do that with PDO.