Hi i have a small problem with the execution of query using if else condition. I have 2 tables i.e dashboard_widget and dashboard_widget_users and in both this table i store my unserialize configuration.Users will always get the configuration from dashboard_widget_users table.But if the configuration is Null then it will take bydefault configuration from dashboard_widget table.I just want to use if else condition and i tried to do so but unable to execute it properly.The condition for if(!empty($empty_config)) is getting satisfied but if it empty then i am not getting any result.Thank you.
dashboard_widget_users table

dashboard_widget table

Here is my php code:
$query = "SELECT dashboard_widget_users.configuration
    FROM dashboard_widget_users
    INNER JOIN yw_user ON dashboard_widget_users.dsnr_yw_user = yw_user.intern
    INNER JOIN dashboard_widget ON dashboard_widget_users.dsnr_dashboard_widget = dashboard_widget.id
    WHERE dashboard_widget_users.dsnr_yw_user =10 AND dashboard_widget.id =1 ";  
$result = mysql_query($query, $myConnection);
if ($row = mysql_fetch_assoc($result)) 
{
    $empty_config=$row['configuration'];
    if (empty($empty_config)) {
        $sql="SELECT dashboard_widget.configuration FROM dashboard_widget WHERE Id =1";
        $sql_result = mysql_query($sql, $myConnection);
        $results = mysql_fetch_assoc($sql_result);  
        $config= unserialize($results['configuration']);
    }
    if (!empty($empty_config)) {
        $config = unserialize($row['configuration']);
        foreach($config as $val)
        {
            //Here is my further things.....                
     }
   }
}
 
     
    