Hi I am having trouble querying a mysql table based on the first value of another table here is my code.
<?php
$host = 'localhost';
$db = 'msdds';
$user = 'root';
$pass = '';
$charset = 'utf8';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$dbh = new PDO($dsn, $user, $pass, $opt);
$sql = $dbh->query("SELECT name FROM employee WHERE remarks != 'done' and branch ='EGYPT' and tenure=""");
$rows = $sql->fetchAll();
echo json_encode($rows);
?>
I want to add a query on tenure based on the first value of another table. I need to query from another table currently it is connected to employee table but I have another table that contains tenure and based on the first value there will be the content of tenure