图像类型斑点

发布于 2025-02-13 07:20:40 字数 4039 浏览 0 评论 0原文

早上好,我正在尝试从MySQL下载blob图像以获取员工表格。下载时,它向我显示了我在下面留下的第一个代码的空字段:

代码1:

<?php
    $con = mysql_connect ("sql213.epizy.com","epiz_31980107","l20DHKEhYd");
    if (!$con){die ("ERROR AL CONECTAR CON LA BASE DE DATOS ".mysql_error());}
    $db = mysql_select_db("epiz_31980107_certificaciones",$con);
    if (!$db) {die ("ERROR AL SELECCIONAR DB ".mysql_error());}


 //ojo: con la sentencia sql, que es la que 
 //utilizamos para la consulta a mas de una tabla

 $sql = ("SELECT empleado.NoReloj,certificaciones.Certificacion,certificaciones.Fecha_Cert,certificaciones.Fecha_Ven 
                FROM empleado, certificaciones WHERE empleado.NoReloj='".$_REQUEST['matricula']."' AND certificaciones.empleado_id ='".$_REQUEST['matricula']."'");

 //realizamos la consulta
 $consulta2= ("SELECT * FROM empleado WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");
$consuimg= ("SELECT Imagen FROM empleado  WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");

 $result2=mysql_query($consulta2);
$resuimg=mysql_query($consuimg);
 $result = mysql_query($sql,$con);


 if(mysql_num_rows($result2)>0){

    if($datos=mysql_fetch_row($result2)){
        $matricula2=$datos[0];
        $img=$datos[1];
        $nombre2=$datos[2];
        $apellido1=$datos[3];
        $apellido2=$datos[4];
        $fecha=$datos[5];
        $area=$datos[6];
        
        
    }
 
 }
 

 ?>

 <table align="center">
  
 <tr>
    <td>Numero de Reloj</td>
    <td>Area</td>
 </tr>
 <tr>
 <td><input type="text" name="matricula" value="<?php echo $matricula2; ?>" disabled></td>
 <td><input type="text" value="<?php echo $area; ?>" disabled></td>
 <img value="<?php echo $img; ?>" />

但是,当我使用下面留下的代码2尝试时,它会给我带来破碎的图像,以至于它不是能够恢复它。如果您能帮助我知道自己在做错什么,我将非常感激。

预先感谢

Code2:

<?php
    
    $con = mysql_connect ("sql213.epizy.com","epiz_31980107","l20DHKEhYd");
    if (!$con){die ("ERROR AL CONECTAR CON LA BASE DE DATOS ".mysql_error());}
    $db = mysql_select_db("epiz_31980107_certificaciones",$con);
    if (!$db) {die ("ERROR AL SELECCIONAR DB ".mysql_error());}


 //ojo: con la sentencia sql, que es la que 
 //utilizamos para la consulta a mas de una tabla

 $sql = ("SELECT empleado.NoReloj,certificaciones.Certificacion,certificaciones.Fecha_Cert,certificaciones.Fecha_Ven 
                FROM empleado, certificaciones WHERE empleado.NoReloj='".$_REQUEST['matricula']."' AND certificaciones.empleado_id ='".$_REQUEST['matricula']."'");

 //realizamos la consulta
 $consulta2= ("SELECT * FROM empleado WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");
$consuimg= ("SELECT Imagen FROM empleado  WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");
 $result2=mysql_query($consulta2);
 $result = mysql_query($sql,$con);
$resimg = mysql_query($consuimg,$con);


 if(mysql_num_rows($result2)>0){

    if($datos=mysql_fetch_row($result2)){
        $matricula2=$datos[0];
        $nombre2=$datos[2];
        $apellido1=$datos[3];
        $apellido2=$datos[4];
        $fecha=$datos[5];
        $area=$datos[6];
        
        
    }
 } 
 while($row = mysql_fetch_assoc($resimg)) {
  ?>
  <img src="data:<?php echo  base64_encode($row['Imagen']); ?>">

 

 <?php
 }

  
 ?>

 <table align="center">

 <tr>
    <td>Numero de Reloj</td>
    <td>Area</td>
 </tr>
 <tr>
 <td><input type="text" name="matricula" value="<?php echo $matricula2; ?>" disabled></td>
 <td><input type="text" value="<?php echo $area; ?>" disabled></td>

Good morning, I'm trying to download a blob image from mysql for an employee form. When downloading it, it shows me the empty field with the first code that I leave below:

Code 1:
enter image description here

<?php
    $con = mysql_connect ("sql213.epizy.com","epiz_31980107","l20DHKEhYd");
    if (!$con){die ("ERROR AL CONECTAR CON LA BASE DE DATOS ".mysql_error());}
    $db = mysql_select_db("epiz_31980107_certificaciones",$con);
    if (!$db) {die ("ERROR AL SELECCIONAR DB ".mysql_error());}


 //ojo: con la sentencia sql, que es la que 
 //utilizamos para la consulta a mas de una tabla

 $sql = ("SELECT empleado.NoReloj,certificaciones.Certificacion,certificaciones.Fecha_Cert,certificaciones.Fecha_Ven 
                FROM empleado, certificaciones WHERE empleado.NoReloj='".$_REQUEST['matricula']."' AND certificaciones.empleado_id ='".$_REQUEST['matricula']."'");

 //realizamos la consulta
 $consulta2= ("SELECT * FROM empleado WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");
$consuimg= ("SELECT Imagen FROM empleado  WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");

 $result2=mysql_query($consulta2);
$resuimg=mysql_query($consuimg);
 $result = mysql_query($sql,$con);


 if(mysql_num_rows($result2)>0){

    if($datos=mysql_fetch_row($result2)){
        $matricula2=$datos[0];
        $img=$datos[1];
        $nombre2=$datos[2];
        $apellido1=$datos[3];
        $apellido2=$datos[4];
        $fecha=$datos[5];
        $area=$datos[6];
        
        
    }
 
 }
 

 ?>

 <table align="center">
  
 <tr>
    <td>Numero de Reloj</td>
    <td>Area</td>
 </tr>
 <tr>
 <td><input type="text" name="matricula" value="<?php echo $matricula2; ?>" disabled></td>
 <td><input type="text" value="<?php echo $area; ?>" disabled></td>
 <img value="<?php echo $img; ?>" />

But when I try it with the code2 that I leave below, it throws me the image as broken that it is not being able to recover it. I would be very grateful if you could help me to know what I am doing wrong.

Thanks in advance

Code2:
enter image description here

<?php
    
    $con = mysql_connect ("sql213.epizy.com","epiz_31980107","l20DHKEhYd");
    if (!$con){die ("ERROR AL CONECTAR CON LA BASE DE DATOS ".mysql_error());}
    $db = mysql_select_db("epiz_31980107_certificaciones",$con);
    if (!$db) {die ("ERROR AL SELECCIONAR DB ".mysql_error());}


 //ojo: con la sentencia sql, que es la que 
 //utilizamos para la consulta a mas de una tabla

 $sql = ("SELECT empleado.NoReloj,certificaciones.Certificacion,certificaciones.Fecha_Cert,certificaciones.Fecha_Ven 
                FROM empleado, certificaciones WHERE empleado.NoReloj='".$_REQUEST['matricula']."' AND certificaciones.empleado_id ='".$_REQUEST['matricula']."'");

 //realizamos la consulta
 $consulta2= ("SELECT * FROM empleado WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");
$consuimg= ("SELECT Imagen FROM empleado  WHERE empleado.NoReloj='" .$_REQUEST['matricula']."'");
 $result2=mysql_query($consulta2);
 $result = mysql_query($sql,$con);
$resimg = mysql_query($consuimg,$con);


 if(mysql_num_rows($result2)>0){

    if($datos=mysql_fetch_row($result2)){
        $matricula2=$datos[0];
        $nombre2=$datos[2];
        $apellido1=$datos[3];
        $apellido2=$datos[4];
        $fecha=$datos[5];
        $area=$datos[6];
        
        
    }
 } 
 while($row = mysql_fetch_assoc($resimg)) {
  ?>
  <img src="data:<?php echo  base64_encode($row['Imagen']); ?>">

 

 <?php
 }

  
 ?>

 <table align="center">

 <tr>
    <td>Numero de Reloj</td>
    <td>Area</td>
 </tr>
 <tr>
 <td><input type="text" name="matricula" value="<?php echo $matricula2; ?>" disabled></td>
 <td><input type="text" value="<?php echo $area; ?>" disabled></td>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文