I have the below PHP function I have written. It's to create a new database table and insert some values to it and another table.

```
function createTable($tablename, $mins){
        $con=mysqli_connect("localhost","****","****","*****");

        // Check connection
        if (mysqli_connect_errno($con))
        {
            echo "Failed to connect to MySQL: " . mysqli_connect_error();
        }
        $tableCreate = "CREATE TABLE rates_{$tablename} (
                                              Weight int(11),
                                              CBMMin double,
                                              CBMMax double,
                                              Min double
                                              )";
        $queryResult = mysqli_query($con, $tableCreate);
        if ($queryResult === TRUE) {
            print "<br /><br />Table Created";
        } else {
            print "<br /><br />No TABLE created. Check " . mysqli_error($con);
        }
        //Echo/print stop working here but below query does fire
        $queryResult = mysqli_query($con, "INSERT INTO Custom_Rates (TableName) VALUES ('rates_{$tablename}');");
        //everything below here does not 
        $rows = array(
                array('weight' => 1000, 'cbm_min' => 0.1, 'cbm_max' => 2.3 ),
                array('weight' => 1500, 'cbm_min' => 2.31, 'cbm_max' => 3.5 ),
                array('weight' => 2000, 'cbm_min' => 3.51, 'cbm_max' => 4.6 ),
                array('weight' => 2500, 'cbm_min' => 4.61, 'cbm_max' => 5.75 ),
                array('weight' => 3000, 'cbm_min' => 5.75, 'cbm_max' => 6.9 ),
                );
        foreach ($rows as $row) {
            $queryResult = mysqli_query($con, "INSERT INTO 'rates_".$tablename."' (Weight, CBMMin, CBMMax) VALUES (".$row['weight'].",".$row['cbm_min'].",".$row['cbm_max'].");");
            if ($queryResult === TRUE) {
                print "<br /><br />Row Created";
            } else {
                print "<br /><br />No Row created. Check " . mysqli_error($con);
            }
        }

```

It seems like the for each loop simple does not get fired as neither the true or false if statements get fired as nothing gets printed.
I had added extra print statements to debug what is actually carried out last and it seems after the 

```
$queryResult = mysqli_query($con, "INSERT INTO Custom_Rates (TableName)
VALUES ('rates_{$tablename}');");

```

line nothing else happens (And I know that this query works because I can see the date in the rates table).

Any ideas as to what could be stopping the foreach from working?