MySQL query using an array

前端 未结 4 2033
野的像风
野的像风 2020-11-30 15:46

I\'m trying to query a MySQL database using an array but I\'m having trouble!

I have a table called clients, I want to be able to select \'name\' from all rows whose

4条回答
  •  情话喂你
    2020-11-30 16:39

    Try This:

    $query1 = "SELECT name FROM clients WHERE sector = '$sectorlink'";
    $clientresult = mysql_query($query1, $connection) or trigger_error("SQL", E_USER_ERROR);
    
    while($row = mysql_fetch_array($clientresult)){
    
    $client = $row['name'];
    
    $query = "SELECT * FROM studies WHERE client='$client' ORDER BY date DESC";
    $result = mysql_query($query, $connection) or trigger_error("SQL", E_USER_ERROR);
    
    /* echo results here */
    
    }
    

提交回复
热议问题