Пример #1
1
function parseFile($file, $type)
{
    $sql = new MySQL();
    $sql->connect('127.0.0.1', 'root', 'root');
    $objReader = PHPExcel_IOFactory::createReader($type);
    $chunkSize = 200;
    $i = 1;
    $sql->clear('price_liga');
    $r = array();
    for ($startRow = 0; $startRow <= 5000; $startRow += $chunkSize + 1) {
        $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
        $objReader->setReadFilter($chunkFilter);
        $objReader->setReadDataOnly(true);
        $objPHPExcel = $objReader->load($file);
        $data = $objPHPExcel->getActiveSheet()->toArray();
        foreach ($data as $k => $v) {
            if ($data[$k][0] == '') {
                unset($data[$k]);
            } else {
                $sql->insert('price_liga', array('id' => $i, 'cat_num' => $data[$k][0], 'brand' => ucwords(strtolower($data[$k][1])), 'article' => $data[$k][2], 'descr' => str_replace("'", "\\'", $data[$k][3]), 'model' => str_replace("'", "\\'", $data[$k][4]), 'size' => $data[$k][5], 'price' => $data[$k][6], 'amount' => $data[$k][8]), true);
                $i++;
            }
        }
    }
    //print_r($r);
    $sql->close();
    return array('counter' => $i);
}
Пример #2
0
function parseFile($file, $type)
{
    $sql = new MySQL();
    $sql->connect('127.0.0.1', 'root', 'root');
    $objReader = PHPExcel_IOFactory::createReader($type);
    $chunkSize = 200;
    $i = 1;
    $sql->clear('price_v8');
    for ($startRow = 0; $startRow <= 5000; $startRow += $chunkSize + 1) {
        $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
        $objReader->setReadFilter($chunkFilter);
        $objReader->setReadDataOnly(true);
        $objPHPExcel = $objReader->load($file);
        $data = $objPHPExcel->getActiveSheet()->toArray();
        foreach ($data as $k => $v) {
            if (trim($data[$k][0]) == 'Артикул' || $data[$k][3] == '' || strstr($data[$k][3], 'камера') || $data[$k][7] == '') {
                unset($data[$k]);
            } else {
                $descr = str_replace('Ш', 'xSTUDEDx', trim($data[$k][3]));
                $descr = preg_replace('/[а-яА-Я]/', '', $descr);
                $sql->insert('price_v8', array('id' => $i, 'article' => trim($data[$k][0]), 'descr' => str_replace("'", "\\'", $descr), 'cat_num' => trim($data[$k][6]), 'season' => trim($data[$k][7]), 'price' => trim($data[$k][9]), 'amount' => trim(preg_replace('/[а-яА-Яa-zA-Z]{0,}/', '', $data[$k][10]))), true);
                $i++;
            }
        }
    }
    $sql->close();
    return array('counter' => $i);
}
Пример #3
0
 public static function recalWorkers()
 {
     $mysql = new MySQL();
     $rs = $mysql->runQuery("select count(id) as cnt, frequency from monitors where active=1 group by frequency;");
     $workers = 0.0;
     while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
         $workers += (double) $row['cnt'] / (double) $row['frequency'];
     }
     $workers = (int) ceil($workers) * 60;
     $mysql->runQuery("update settings set cronIterations={$workers};");
     $mysql->close();
 }
Пример #4
0
function parseFile($file, $type)
{
    $sql = new MySQL();
    $sql->connect('127.0.0.1', 'root', 'root');
    $objReader = PHPExcel_IOFactory::createReader($type);
    $sheets = $objReader->listWorksheetNames($file);
    $i = 1;
    $sql->clear('price_moscow');
    foreach ($sheets as $sheet) {
        $chunkSize = 200;
        if (strstr($sheet, 'Шины')) {
            $r = array();
            for ($startRow = 0; $startRow <= 4000; $startRow += $chunkSize + 1) {
                $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
                $objReader->setReadFilter($chunkFilter);
                $objReader->setReadDataOnly(true);
                $objReader->setLoadSheetsOnly($sheet);
                $objPHPExcel = $objReader->load($file);
                $data = $objPHPExcel->getActiveSheet()->toArray();
                foreach ($data as $k => $v) {
                    if ($data[$k][2] == '' || $data[$k][2] == 'Модель') {
                        unset($data[$k]);
                    } else {
                        $season = strstr($data[$k][7], 'Летняя') ? 0 : (strstr($data[$k][7], 'Зимняя') ? 1 : 2);
                        $vtype = strstr($data[$k][8], 'Легковая') ? 0 : (strstr($data[$k][8], 'Грузовая') ? 1 : 2);
                        $stunds = $data[$k][10] == '' || $data[$k][10] == 'Нет' ? 0 : 1;
                        $xl = $data[$k][12] == '' || $data[$k][12] == 'Нет' ? 0 : 1;
                        $runflat = $data[$k][13] == '' || $data[$k][13] == 'Нет' ? 0 : 1;
                        $sql->insert('price_moscow', array('id' => $i, 'article' => trim($data[$k][0]), 'brand' => ucwords(strtolower(trim($data[$k][1]))), 'model' => str_replace("'", "\\'", trim($data[$k][2])), 'width' => trim($data[$k][3]), 'height' => trim($data[$k][4]), 'diameter' => (int) preg_replace('/[a-zA-Z]/', '', trim($data[$k][5])), 'weight_speed' => trim($data[$k][6]), 'season' => $season, 'v_type' => $vtype, 'studs' => $stunds, 'xl' => $xl, 'runflat' => $runflat, 'price_rrc' => $data[$k][17], 'price_opt' => $data[$k][18], 'amount' => 0), true);
                        $i++;
                    }
                }
            }
        }
    }
    $sql->close();
    return array('counter' => $i);
}
Пример #5
0
            echo "<li>" . $row[$j][1] . " (" . $row[$j][2] . ") - <font color='brown'>" . $row[$j][8] . "/10</font></li>";
        }
    }
}
echo "</ol>";
$sql = "SELECT m.*, floor((((m.m_year - YEAR(p1.age)))*12 + (((01 - MONTH(p1.age)))))/12) as age  FROM movie m join movie_person p join person p1 where m.movie_id = p.movie_id and p.person_id = p1.personid and p.person_id = '" . $reqparam . "' and mtype = 'Feature Film' order by 3 asc";
$row = $db->QueryArray($sql);
echo "<hr/><br/> Feature Films:<br/>";
echo "<ol>";
for ($j = 0; $j < count($row); $j++) {
    if ($row[$j][8] >= 8) {
        echo "<li><b><font color='green'>" . $row[$j][1] . " (" . $row[$j][2] . ") </font>- <font color='brown'>" . $row[$j][8] . "/10</font></b></li>";
    } else {
        if ($row[$j][8] == 7) {
            echo "<li><font color='blue'>" . $row[$j][1] . " (" . $row[$j][2] . ") </font>- <font color='brown'>" . $row[$j][8] . "/10</font></li>";
        } else {
            echo "<li>" . $row[$j][1] . " (" . $row[$j][2] . ") - <font color='brown'>" . $row[$j][8] . "/10</font></li>";
        }
    }
}
echo "</ol>";
echo " <br/>(*<i>Favorites/Excellent/Loved It = Green; </br>&nbsp;&nbsp; Good Film/Liked It = Blue</i>). ";
?>
	  	    
	<?php 
$db->close();
?>
	<br/>
</body>
</html>
Пример #6
0
                </tr>
				<?php 
        $desc = $val["TestPadreDescripcion"];
        // TestPadreDescripcion
        $tpp = $val["TestPadrePadre"];
        // TestPadrePadre
        $diagnostico = $val["OrdDiagnostico"];
        // Diagnostico
    }
    ?>
        </table>						
        <br />
	<?php 
    unset($resultados);
}
$_db->close();
?>
		
	<br />
	<?php 
if (!empty($diagnostico)) {
    ?>
		<div>
			<b>Observaciones y Comentarios a la Solicitud:</b><br/><?php 
    echo $diagnostico;
    ?>
		</div>
	<?php 
}
?>
		
Пример #7
0
 function DetalleOrden($header, $TurnId, $OrdId, $tbl_name)
 {
     $_db = new MySQL();
     $_db->connect();
     /* Consulto los Examenes - Nuevo Esquema para generar el Menu */
     $ex = array();
     $_sql = "SELECT CASE\r\n\t\t\t\t\tWHEN TestPadrePadre!='' THEN TestPadrePadre\r\n\t\t\t\t\tWHEN TestPadreDescripcion!='' THEN TestPadreDescripcion\r\n\t\t\t\t\tEND AS test\r\n\t\t\t\t FROM {$tbl_name} WHERE EstadoProcesa='V' GROUP BY test ORDER BY test";
     $_db->prepare($_sql);
     //echo $_sql;
     $_result = $_db->execute();
     while (@($data = $_db->fetch_array($_result))) {
         $ex[] = $data["test"];
     }
     $_db->free($_result);
     //Verifico elementos repetidos en el array
     $exams = array_unique($ex);
     /* Barro Todos los Test Padres */
     $np = 0;
     foreach ($exams as $key => $value) {
         // Test Descripcion
         $this->Ln();
         $this->SetFont('Arial', 'B', 10);
         $this->Cell(10, 10, ucwords(strtolower(str_replace(":", " ", $value))), '', 0, 'L', false);
         $this->Ln();
         // Colores, ancho de linea y fuente en negrita
         $this->SetFillColor(101, 101, 101);
         $this->SetTextColor(255);
         $this->SetDrawColor(80, 80, 80);
         $this->SetLineWidth(0.3);
         $this->SetFont('Arial', '', 9);
         // Cabecera
         $w = array(60, 50, 25, 60);
         for ($i = 0; $i < count($header); $i++) {
             $this->Cell($w[$i], 6, $header[$i], 1, 0, 'C', true);
         }
         $this->Ln();
         // Consulto Resultados
         //$this->SetFont('Arial','',9);
         $fill = false;
         $test = trim(str_replace(":", " ", $value));
         $resultados = array();
         $_sql = "SELECT OrdId, OrdTurno, OrdFecha, CONCAT(PacNombre,' ',PacApellido) as Paciente, \r\n\t\t\t\t\t  CONCAT(MedNombre,' ',MedApellido)as Medico, TestDescripcion, Resultado, Unidad, \r\n\t\t\t\t\t  RanValInf, RanValSup, RanMultiple, TestPadre, TestPadreDescripcion, EmpId, EmpDescripcion,\r\n\t\t\t\t\t  TestNivel, TestPadrePadre, '' AS TestPadrePadrePadre, OrdDiagnostico\r\n\t\t\t\t\tFROM `{$tbl_name}` \r\n\t\t\t\t\tWHERE OrdTurno='{$TurnId}' AND OrdId='{$OrdId}' AND EstadoProcesa='V'  \r\n\t\t\t\t\t  AND (TestPadreDescripcion like '%{$test}%' Or TestPadrePadre like '%{$test}%') ";
         if ($test == 'BACTERIOLOGIA') {
             //$_sql .= " ORDER BY TestNivel, TestSubNivel, TestPadreDescripcion ";
             $_sql .= " ORDER BY TestPadre, TestNivel, TestSubNivel ";
         } else {
             if ($test == 'ORINA') {
                 $_sql .= " ORDER BY TestNivel ";
             } else {
                 $_sql .= " ORDER BY TestPadreDescripcion, TestNivel, TestSubNivel ";
             }
         }
         //echo $_sql;
         $_db->prepare($_sql);
         $_result = $_db->execute();
         while (@($data = $_db->fetch_array($_result))) {
             $resultados[] = $data;
         }
         $_db->free($_result);
         /* Muestra los Resultados */
         $i = 1;
         $j = 1;
         $limite = 26;
         foreach ($resultados as $k => $val) {
             $nivel = $val["TestNivel"];
             //Nivel del Examen
             if ($val["TestPadreDescripcion"] != $desc) {
                 $i = 1;
                 //Inicializo i
                 $j = 1;
                 //Inicializo j
             }
             /* Seteo el Formato drl Texto en las cabeceras de los Resultados */
             $this->SetFillColor(255, 255, 255);
             $this->SetTextColor(0);
             $this->SetFont('Arial', 'B', 9);
             if ($nivel > 1) {
                 switch ($nivel) {
                     case "2":
                         if ($i == 1) {
                             $this->Cell($w[0], 6, ucwords(strtolower(str_replace(":", " ", $val["TestPadreDescripcion"]))), '', 0, 'L', false);
                             $this->Ln();
                             //Salto de Linea
                         }
                         $i++;
                         break;
                     case "3":
                         if ($i == 1) {
                             if ($tpp != $val["TestPadrePadre"]) {
                                 $this->Cell($w[0], 6, ucwords(strtolower(str_replace(":", " ", $val["TestPadrePadre"]))), '', 0, 'L', false);
                                 $this->Ln();
                                 //Salto de Linea
                             }
                         }
                         if ($j == 1) {
                             $this->Cell($w[0], 6, ucwords(strtolower(str_replace(":", " ", $val["TestPadreDescripcion"]))), '', 0, 'L', false);
                             $this->Ln();
                             //Salto de Linea
                         }
                         $i++;
                         $j++;
                         break;
                 }
             }
             // Restauracion de colores y fuentes
             $this->SetFillColor(224, 235, 255);
             $this->SetTextColor(0);
             $this->SetFont('Arial', '', 9);
             /* Presenta los Resultados */
             $flag = false;
             $exa = "";
             $resul = "";
             $rango = "";
             # Verifica la Longitud del Examen
             if (strlen($val["TestDescripcion"]) >= $limite) {
                 if (strstr($val["TestDescripcion"], '<br>')) {
                     $exa = $val["TestDescripcion"];
                 } else {
                     $exa = FormatString($val["TestDescripcion"], $limite);
                     $flag = true;
                 }
             } else {
                 $exa = $val["TestDescripcion"];
             }
             # Verifica la Longitud del Resultado
             if (strlen($val["Resultado"]) >= $limite) {
                 if (strstr($val["Resultado"], '<br>')) {
                     $resul = $val["Resultado"];
                 } else {
                     $resul = FormatString($val["Resultado"], $limite);
                     $flag = true;
                 }
             } else {
                 $resul = $val["Resultado"];
             }
             # Verifica los rangos referenciales
             if (!empty($val["RanValInf"]) || !empty($val["RanValSup"])) {
                 $rango = $val["RanValInf"] . " - " . $val["RanValSup"];
             } else {
                 if (!empty($val["RanMultiple"])) {
                     $rango = str_replace("<br>", "\n", $val["RanMultiple"]);
                     $flag = true;
                 }
             }
             if (!$flag) {
                 $this->Cell($w[0], 6, $exa, 'LR', 0, 'L', $fill);
                 // Nombre del Examen
                 $this->Cell($w[1], 6, $resul, 'LR', 0, 'C', $fill);
                 // Resultado
                 $this->Cell($w[2], 6, $val["Unidad"], 'LR', 0, 'C', $fill);
                 // Unidad
                 $this->Cell($w[3], 6, $rango, 'LR', 0, 'C', $fill);
                 // Rango Minimo - Rango Maximo
             } else {
                 $this->SetFont('Arial', '', 9);
                 $this->SetWidths(array(60, 50, 25, 60));
                 if (strlen($rango) < $limite) {
                     $this->SetAligns(array('L', 'C', 'C', 'C'));
                 } else {
                     $this->SetAligns(array('L', 'C', 'C', 'L'));
                 }
                 $this->Row(array(utf8_decode(str_replace("<br/>", "\n", $exa)), utf8_decode(str_replace("<br/>", "\n", $resul)), utf8_decode($val["Unidad"]), $rango));
             }
             $this->Ln();
             $fill = !$fill;
             $desc = $val["TestPadreDescripcion"];
             // Guardo El Test Anterior - TestPadreDescripcion
             $tpp = $val["TestPadrePadre"];
             // TestPadrePadre
             $diagnostico = $val["OrdDiagnostico"];
             // Diagnostico
         }
         $this->Cell(array_sum($w), 0, '', 'T');
         $this->Ln();
         $this->Cell(200, 10, '* Sin valor legal, para ese efecto acerquese al Laboratorio Principal', 0, 0, 'C');
         $np++;
         if (count($exams) - $np != 0) {
             $this->AddPage();
         }
     }
     # Imprimo el Diagnostico
     if (!empty($diagnostico)) {
         $this->Ln(20);
         $this->SetFont('Arial', 'B', 10);
         $this->Cell(80, 6, "Observaciones y Comentarios a la Solicitud:", '', 'L', $fill);
         $this->SetFont('Arial', '', 10);
         $this->Cell(120, 6, $diagnostico, '', 'L', $fill);
     }
     $_db->close();
 }
Пример #8
0
            $gen = $result_array[$i]->gender;
            $st = $result_array[$i]->status;
            if ($i % 2 == 1) {
                $table .= "<tr class='alt'>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$nm} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$tm}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$spr}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$pos}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$ispri}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gr} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gen}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$st} </font></td>\n\t\t\t\t\t\t</tr>";
            } else {
                $table .= "<tr>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$nm} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$tm}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$spr}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$pos}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$ispri}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gr} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gen}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$st} </font></td>\n\t\t\t\t\t\t</tr>";
            }
            $i += 1;
        }
        if (empty($table)) {
            $table .= "<tr>\n\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>No Entries!</font></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t</tr>";
        }
    }
    //close database connections
    try {
        $con->close();
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>View Squad Members</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/arial.js"></script>
<script type="text/javascript" src="js/cuf_run.js"></script>
Пример #9
0
            }
            //if a pluggin doesnt return content the email will error
            if (isset($output['returnContent']) && $output['returnContent'] != '') {
                $body = $output['returnContent'];
            } else {
                $body = 'plugin returned no data';
            }
            if ((bool) $output['htmlEmail']) {
                $mail->AltBody = $body;
                $mail->MsgHTML($body);
                $mail->IsHTML = (bool) $output['htmlEmail'];
            } else {
                $mail->Body = $body;
            }
            if (!$mail->Send()) {
                echo "Mailer Error: " . $mail->ErrorInfo;
            }
        }
        //log output
        $sql = "insert into logging (monitorId,dateTime,responseTimeMs,measuredValue,returnContent,status) values({$id},now(),{$output['responseTimeMs']},'" . mysql_real_escape_string($output['measuredValue'], $mysql->mysqlCon) . "','" . mysql_real_escape_string($output['returnContent'], $mysql->mysqlCon) . "',{$output['currentStatus']});";
        $mysql->runQuery($sql);
        echo date('Y-m-d H:i:s') . "\t{$pluginType}\t{$id}\t{$name}\tEnded\t" . round($t->stop(), 0) . " ms \n";
    } else {
        $mysql->runQuery("UNLOCK TABLES;");
        //echo("UNLOCKED\n");
        //echo "no more work to do\n";
        sleep(1);
        //usleep(500*1000);	//500 milliseconds
    }
    $mysql->close();
}
Пример #10
0
function adm_installer_addsql($id)
{
    global $db_host, $db_user, $db_pass, $db_name;
    // Get information from Zantastico's DB
    $dbconn = mysql_connect('mysql.zee-way.com', 'zantastico', '');
    mysql_select_db('zp_zantastico', $dbconn);
    $sql = "SELECT * FROM zantastico WHERE id='" . $id . "'";
    $result = mysql_query($sql, $dbconn);
    $installer = mysql_fetch_assoc($result);
    // Getting filename
    $filename = substr(strrchr($installer['zip'], '/'), 1);
    // Transfer the information to this ZPanel
    $mysql = new MySQL($db_host, $db_user, $db_pass, $db_name);
    $sql = sprintf("INSERT INTO zantastico (name,version,website,welcome,instructions,finalmessage,exampledir,catid,zip,uniquekey) VALUES ('%s','%s','%s','%s','%s','%s','%s',%s,'%s','%s')", mysql_real_escape_string($installer['name']), mysql_real_escape_string($installer['version']), mysql_real_escape_string($installer['website']), mysql_real_escape_string($installer['welcome']), mysql_real_escape_string($installer['instructions']), mysql_real_escape_string($installer['finalmessage']), mysql_real_escape_string($installer['exampledir']), mysql_real_escape_string($installer['catid']), mysql_real_escape_string($filename), mysql_real_escape_string($installer['uniquekey']));
    $result = $mysql->query($sql);
    // Get Category information
    $sql = "SELECT * FROM zantastico_categories WHERE id='" . $installer['catid'] . "'";
    $result = mysql_query($sql, $dbconn);
    $category = mysql_fetch_assoc($result);
    // Create category
    $sql = sprintf("INSERT INTO zantastico_categories (id,name) VALUES ('%s','%s')", $category['id'], str_replace("'", '&apos;', $category['name']));
    $result = $mysql->query($sql);
    // Free the result in memory
    $mysql->close();
    // Instantiate the xajaxResponse object
    $objResponse = new xajaxResponse();
    //return the XML response generated by the xajaxResponse object
    return $objResponse->getXML();
}
Пример #11
0
if ($create) {
    echo "<br>Creating User " . $db2['user'] . " ... ";
    $databasename = $db2['dbase'];
    $username = $db2['user'];
    $userpass = $db2['pass'];
    include "create_user.php";
    if ($SQL->error_no != 0) {
        die(BAD . " failed! -&gt; " . $SQL->error_msg);
    } else {
        echo GOOD;
    }
}
if (defined('LOAD_MYSQL') && $create) {
    echo "<br>If there occured an custom error without " . "errornumber obove, ignore it. It seems to be a bug :(";
}
$SQL->close();
echo "<br>Connecting as User ... ";
$SQL = new MySQL($db2);
if ($SQL->error_no != 0) {
    die("<span style=\"color:red;\">User connection to database could " . "not be etablished!<br>" . "Please check your config in " . __FILE__ . " !</span>");
} else {
    echo GOOD;
}
if ($db2['create_T']) {
    echo "<br>Creating Tables ... ";
    $SQL->change_db($db2['dbase']);
    include "database.php";
    while (list(, $q) = each($table)) {
        #	echo "<br>".$q;
        if (!$SQL->query($q)) {
            die("<br>Error while doing: " . $q . " -&gt; " . $SQL->error_msg);