图像类型斑点
早上好,我正在尝试从MySQL下载blob图像以获取员工表格。下载时,它向我显示了我在下面留下的第一个代码的空字段:
<?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尝试时,它会给我带来破碎的图像,以至于它不是能够恢复它。如果您能帮助我知道自己在做错什么,我将非常感激。
预先感谢
<?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:
<?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
<?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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论