I have two tables:
CREATE TABLE `czujniki` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(20) COLLATE utf8_polish_ci NOT NULL,
  `name` varchar(20) COLLATE utf8_polish_ci NOT NULL,
  `address` varchar(20) COLLATE utf8_polish_ci NOT NULL,
  `desc` varchar(255) COLLATE utf8_polish_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
CREATE TABLE `temperature` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_czujnik` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `temp` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
Also have 3 values address, time, and temp what is the best way to add this values to table?
Already I do it in PHP in this way:  
$z = mysqli_query($con, "SELECT `id` 
                        FROM `czujniki` 
                        WHERE `address` = {$address}");
  $row = mysqli_fetch_all($z,MYSQLI_NUM);
  $id = $row[0][0]
  $z = mysqli_query($con, "INSERT INTO `temperature` 
                                    (`id_czujnik`, `time`, `temp`) 
                            VALUES ({$id}, {$time}, {$temp})");
Is there a better way to do it?
 
    