PHP SQL read associative array
<p>so basically what I want to do is this:
read out filesize stored in table "dbdateien" in column "dateigroesse"</p>

<p>Then I want to make the sum of all the filesizes and substract them from the upload space limit. To show the user: You have 20 mb free storage left!</p>

<p>My problem is when I fetch the result of the query it gives me every value from the array double...</p>

<p><strong>This is my code:</strong></p>

<pre><code>    $pdo = new PDO("mysql:host=$servername;dbname=u-jv029", $username, $password);
$stmt3 = $pdo-&gt;prepare("SELECT dateigroesse FROM dbdateien");

$stmt3-&gt;execute();
$result= $stmt3-&gt;fetchAll();

foreach($result as $show){

    foreach($show as $display){
        echo('&lt;br /&gt;Value: ' . $display);
    }
}
echo "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;";
var_dump($result);
</code></pre>

<p><strong>This is the result:</strong></p>

<pre><code>Value: 0
Value: 0
Value: 0
Value: 0
Value: 0
Value: 0
Value: 2.29
Value: 2.29
Value: 4.5
Value: 4.5
Value: 1.2
Value: 1.2


array(6) { [0]=&gt; array(2) { ["dateigroesse"]=&gt; string(1) "0" [0]=&gt; string(1) "0" } [1]=&gt; array(2) { ["dateigroesse"]=&gt; string(1) "0" [0]=&gt; string(1) "0" } [2]=&gt; array(2) { ["dateigroesse"]=&gt; string(1) "0" [0]=&gt; string(1) "0" } [3]=&gt; array(2) { ["dateigroesse"]=&gt; string(4) "2.29" [0]=&gt; string(4) "2.29" } [4]=&gt; array(2) { ["dateigroesse"]=&gt; string(3) "4.5" [0]=&gt; string(3) "4.5" } [5]=&gt; array(2) { ["dateigroesse"]=&gt; string(3) "1.2" [0]=&gt; string(3) "1.2" } }
</code></pre>

<p>I am thankful for any help!</p>