Skip to content

Commit

Permalink
Add DB_NAME2 constant and update SQL query in info_display.php
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinMadygraf committed Mar 27, 2024
1 parent 22da923 commit 9ec2754
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions includes/conn_novus.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '12345678');
define('DB_NAME', 'novus');
define('DB_NAME2', 'registro_stock');

?>
7 changes: 0 additions & 7 deletions includes/conn_stock.php

This file was deleted.

31 changes: 20 additions & 11 deletions includes/info_display.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@
$vel_ult_calculada = round($vel_ult / 5, 1);
$estiloFondo = "background: linear-gradient(195deg, rgb(107,170,34) {$d[3]}%, rgb(255,164,1) {$d[2]}%, rgb(234,53,34) {$d[1]}%, rgb(100,10,5) {$d[0]}%);";

//$sql = "SELECT * FROM `produccion_bolsas_aux`";
$sql = "SELECT * FROM `produccion_bolsas_aux`";
//conexcion a base de datos "registro_stock"
//require_once 'includes/conn_stock.php';
//$conexion = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
//$result = mysqli_query($conexion, $sql);
//$datos = mysqli_fetch_assoc($result);
//$datos = json_encode($datos);
//mysqli_close($conexion);
$conexion2 = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME2);

//print_r($datos);
if (!$conexion2) {
die("Connection failed: " . mysqli_connect_error());
}

$formato = "260 x 120 x 360";
$ancho_bobina = "790 mm";
// Ejecutar la consulta
$result = mysqli_query($conexion2, $sql);

if ($result && mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
// Suponiendo que quieres el último valor (o adapta según tu lógica)
$formato = $row['ID_formato']; // Asume que las columnas existen
$ancho_bobina = "{$row['ancho_bobina']} mm";
}
} elseif (!$result) {
echo "Error al ejecutar la consulta: " . mysqli_error($conexion2);
} else {
echo "No se encontraron resultados.";
}
?>

<div id="zero" class="hoja" style="<?php echo $estiloFondo; ?>">
<div class="info">
<div class="cabecera">
<div class="c1">
<p1>Velocidad <?php echo $vel_ult_calculada; ?> unidades por minuto</p1>
<p1>Formato <?php echo $formato;?></p1>
<p1>ID_Formato <?php echo $formato;?></p1>
<p1>Ancho Bobina <?php echo $ancho_bobina;?></p1>
</div>
</div>
Expand Down

0 comments on commit 9ec2754

Please sign in to comment.