$db = new db(); $db = $db->connect(); $sqlproducts = "SELECT * FROM products ";
$resultproducts = $db->query($sqlproducts);
while($rowproducts = $resultproducts->fetchAll(PDO::FETCH_OBJ) ){
echo '{"Products": ' . json_encode($rowproducts) .' }'; $sqlskus = "SELECT * FROM sku ";
$resultsku = $db->query($sqlskus); while($rowsku = $resultsku->fetchAll(PDO::FETCH_OBJ)){
echo '{"Products": ' . json_encode($rowsku ) . '}'; } }
the result give me just the data of the first select
If you can use a JOIN to fetch data from another table.
Again, this has nothing to do with Slim.
You should first learn how to do common tasks with plain PHP before getting into a framework like Slim.
Just my two cents.
1 Like