Buongiorno a tutti

Chiedo un aituo per una formula php che in alcuni casi da risultato 0 e mi da un errore "Division by zero".

Posto il codice per favore potete aiutarmi a risolvere il problema?

Grazie a tutti per aiuto

Buonasera

Codice PHP:

$click_active_bought=mysql_fetch_assoc(mysql_query("SELECT (SUM(plan)) AS total_click_active_bought FROM yob_ads WHERE user <> 'admin' AND ads_category = 'click' AND status = 'active'"));
$click_active_sent=mysql_fetch_assoc(mysql_query("SELECT (SUM(members)) AS total_click_active_sent FROM yob_ads WHERE user <> 'admin' AND ads_category = 'click' AND status = 'active'"));
$click_active_available=mysql_fetch_assoc(mysql_query("SELECT (SUM(plan-members)) AS total_click_active_available FROM yob_ads WHERE user <> 'admin' AND ads_category = 'click' AND status = 'active'"));



<tr>
        <th width="250">Total Click Active Sold</th>
        <td>[b]<font color='blue'><?php echo $click_active_bought[total_click_active_bought]; ?> [/b] </font> (<?php echo round(($click_active_bought[total_click_active_bought]/$click_active_bought[total_click_active_bought]*100),2); ?>%) </td>
    </tr>
    <tr>
        <th width="250">Total Click Active Sent</th>
        <td>[b]<font color='green'><?php echo $click_active_sent[total_click_active_sent]; ?> [/b] </font> (<?php echo round(($click_active_sent[total_click_active_sent]/$click_active_bought[total_click_active_bought]*100),2); ?>%) </td>
    </tr>
    <tr>
        <th width="250">Total Click Active Available</th>
        <td>[b]<font color='red'><?php echo $click_active_available[total_click_active_available]; ?> [/b] </font> (<?php echo round(($click_active_available[total_click_active_available]/$click_active_bought[total_click_active_bought]*100),2); ?>%) </td>
    </tr>