Php 从数据库获取数据并在html上打印

Php 从数据库获取数据并在html上打印,php,Php,我正在写一个code,它应该从数据库中获取数据、图像和其他信息,然后在页面上打印数据。对于图像,它应该从数据库中提取,并在框上打印图像,以及相应区域的其他信息 代码如下所示 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <meta name="generator" conte

我正在写一个
code
,它应该从
数据库
中获取数据、
图像
和其他信息,然后在页面上打印数据。对于
图像
,它应该从
数据库
中提取,并在框上打印
图像
,以及相应区域的其他信息

代码如下所示

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<meta name="generator" content="Web Page Maker">
<style type="text/css">
/*----------Text Styles----------*/
.ws6 {font-size: 8px;}
.ws7 {font-size: 9.3px;}
.ws8 {font-size: 11px;}
.ws9 {font-size: 12px;}
.ws10 {font-size: 13px;}
.ws11 {font-size: 15px;}
.ws12 {font-size: 16px;}
.ws14 {font-size: 19px;}
.ws16 {font-size: 21px;}
.ws18 {font-size: 24px;}
.ws20 {font-size: 27px;}
.ws22 {font-size: 29px;}
.ws24 {font-size: 32px;}
.ws26 {font-size: 35px;}
.ws28 {font-size: 37px;}
.ws36 {font-size: 48px;}
.ws48 {font-size: 64px;}
.ws72 {font-size: 96px;}
.wpmd {font-size: 13px;font-family: Arial,Helvetica,Sans-Serif;font-style: normal;font-weight: normal;}
/*----------Para Styles----------*/
DIV,UL,OL /* Left */
{
 margin-top: 0px;
 margin-bottom: 0px;
}
</style>

<style type="text/css">
div#container
{
    position:relative;
    width: 1229px;
    margin-top: 0px;
    margin-left: auto;
    margin-right: auto;
    text-align:left; 
}
body {text-align:center;margin:0}
</style>

</head>
<body>
<?php
include 'config.php';
if(isset($_GET['submit']))
{

    $con = mysqli_connect($hostname, $user, $password, $db) or die('cannot connect');
    $number = mysqli_real_escape_string($con,$_POST['number']);
    $sql = "SELECT * FROM personaz WHERE number = $number";
    $sth = $db->query($sql);
    $result = mysqli_fetch_array($sth);

    $imagea = 
}
?>
<div id="container">
<form name="people" method="GET" action="info2.php" style="margin:0px">
<input name="number" type="text" style="position:absolute;width:200px;left:399px;top:133px;z-index:3">
</form>

<div id="text1" style="position:absolute; overflow:hidden; left:236px; top:91px; width:150px; height:26px; z-index:1">
<div class="wpmd">
<div><font class="ws16">People Data</font></div>
</div></div>

<!--[if IE]><div id="table1" style="position:absolute; overflow:hidden; left:782px; top:98px; width:187px; height:177px; z-index:2; border:#969696 1px solid"><![endif]-->
<!--[if !IE]>--><div id="table1" style="position:absolute; overflow:hidden; left:782px; top:98px; width:185px; height:175px; z-index:2; border:#969696 1px solid"><!--<![endif]-->

<div class="wpmd">
<div><TABLE bgcolor="#FFFFFF" border=0 bordercolorlight="#C0C0C0" bordercolordark="#808080">
<TR valign=top>
<TD width=220 height=203><BR>
<?php echo $image?>
</TD>
</TR>
</TABLE>
</div>
</div></div>

<div id="text2" style="position:absolute; overflow:hidden; left:242px; top:134px; width:150px; height:18px; z-index:4">
<div class="wpmd">
<div>Enter Tel Number :</div>
</div></div>

<div id="text3" style="position:absolute; overflow:hidden; left:242px; top:186px; width:150px; height:32px; z-index:5">
<div class="wpmd">
<div>Fullname : </div>
</div></div>

<div id="text4" style="position:absolute; overflow:hidden; left:238px; top:232px; width:77px; height:32px; z-index:6">
<div class="wpmd">
<div>EMail : </div>
</div></div>

<div id="text5" style="position:absolute; overflow:hidden; left:235px; top:281px; width:150px; height:32px; z-index:7">
<div class="wpmd">
<div>Telephone : </div>
</div></div>

<div id="hr1" style="position:absolute; overflow:hidden; left:205px; top:379px; width:819px; height:16px; z-index:8">
<hr size=2 width=819>
</div>

</div>

</body>
</html>

无标题
/*----------文本样式----------*/
.ws6{字体大小:8px;}
.ws7{字体大小:9.3px;}
.ws8{字体大小:11px;}
.ws9{字体大小:12px;}
.ws10{字体大小:13px;}
.ws11{字体大小:15px;}
.ws12{字体大小:16px;}
.ws14{字体大小:19px;}
.ws16{字体大小:21px;}
.ws18{字体大小:24px;}
.ws20{字体大小:27px;}
.ws22{字体大小:29px;}
.ws24{字体大小:32px;}
.ws26{字体大小:35px;}
.ws28{字体大小:37px;}
.ws36{字体大小:48px;}
.ws48{字体大小:64px;}
.ws72{字体大小:96px;}
.wpmd{字体大小:13px;字体系列:Arial,Helvetica,无衬线;字体样式:普通;字体重量:普通;}
/*----------Para样式----------*/
左/右分区*/
{
边际上限:0px;
边缘底部:0px;
}
分区#集装箱
{
位置:相对位置;
宽度:1229px;
边际上限:0px;
左边距:自动;
右边距:自动;
文本对齐:左对齐;
}
正文{文本对齐:居中;边距:0}
人员数据

输入电话号码: 全名: 电邮: 电话:
我该怎么做呢?急需帮助。

“/>
<img src="data:image/jpeg;base64,<?php echo base64_encode($result['pic']) ?>"/>
您必须用从数据库获得的图像块替换
$result['pic']

您必须用从数据库中获取的图像BLOB替换
$result['pic']

您是将图像作为BLOB保存在数据库中还是以何种方式保存?@lucajung99,是的,我保存为BLOB,但是当我使用php发送到数据库时,我得到了BLOB-0B。您是否使用phpMyAdmin检查数据库中是否保存了大于0B的BLOB?您是否将图像保存为BLOB,或者以何种方式保存?@lucajung99,是的,我保存为BLOB,但当我使用php发送到数据库时,我得到了BLOB-0B。您是否使用phpMyAdmin检查数据库中是否保存了BLOB>0B?