还有就是怎样用PHP实现相册功能啊? 就是用户上传照片,建一个相册1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 img.htm -------- <html> <head> <title>图片提交</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body bgcolor="#FFFFFF" text="#000000"> <form name="form" method="post" action="imgcun.php"> <table width="150" border="1" align="center" bordercolor="#0099FF"> <tr> <td height="30"> <input type="file" name="img" size="40"> </td> </tr> <tr> <td height="54"> <textarea name="img_jj" cols="50" rows="5"></textarea> </td> </tr> <tr> <td> <div align="center"> <input type="submit" name="Submit" value="提交"> </div> </td> </tr> </table> </form> <p align="center"><a href="imgshow.php">图片展示</a></p> </body> </html> imgcun.php ---------- <? if($img=="") { echo"文件没有上传!"; exit; } $wen=time().".jpg"; if(copy($img,$wen)) { echo"上传成功"; $link=mysql_connect("localhost","root"); mysql_select_db("wdn",$link); $query="insert into img(img,img_jj) values('$wen','$img_jj')"; if(mysql_query($query)) { echo"<br>"; echo "数据存储成功"; echo"<br>"; echo "<img src='".$wen."'>"; } } ?> imgshow.php ------------- <html> <head> <title>图片展示</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body bgcolor="#FFFFFF" text="#000000"> <? $link=mysql_connect("localhost","root"); mysql_select_db("wdn"); $pd=mysql_query('select * from img',$link); $i=0; echo"<table width='700' border='0' cellspacing='20'>"; echo"<tr>"; while($array=mysql_fetch_array($pd)) { $i++; echo"<td width='150'> "; echo"<table width='150' border='1' bordercolor='#0099FF'>"; echo"<tr>"; echo"<td width='150'><font size='2'><a href='".$array[img]."'><img src='".$array[img]."' width='150' border='0' alt='ID:".$array[img]."' ></a></font></td>"; echo"</tr>"; echo"<tr> "; echo"<td width='150'><font size='2'>图片简介:".$array[img_jj]."</font></td>"; echo"</tr>"; echo"</table>"; echo"</td>"; if($i%4=="0") { echo"</tr>"; } } echo"</table>"; ?> </body> </html> 数据库: ------ CREATE TABLE img ( img varchar(15) default NULL, img_jj varchar(100) default NULL ) TYPE=MyISAM; http://topic.csdn.net/t/20020518/02/731921.html 我想每个用户每次留言记录都保留 正则表达式问题 Session 和 Cookie的问题 问下查询的问题 打印问题,如何让客户打印web页的时候不显示,标题,页码,链接,日期 字符串截取的问题,请教高手! !!!!!!网罗一些代码!!!!!! (*_*) 过年好,不过问题还要问啊!! 多个foreach嵌套循环的问题 求一段可以把 两个表单进行简单的计算,并可以提交到数据库的代码 请教一下LAMP的配置问题 关于php session传值的问题
--------
<html>
<head>
<title>图片提交</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form" method="post" action="imgcun.php">
<table width="150" border="1" align="center" bordercolor="#0099FF">
<tr>
<td height="30">
<input type="file" name="img" size="40">
</td>
</tr>
<tr>
<td height="54">
<textarea name="img_jj" cols="50" rows="5"></textarea>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="submit" name="Submit" value="提交">
</div>
</td>
</tr>
</table>
</form>
<p align="center"><a href="imgshow.php">图片展示</a></p>
</body>
</html>
imgcun.php
----------
<?
if($img=="")
{
echo"文件没有上传!";
exit;
}
$wen=time().".jpg";
if(copy($img,$wen))
{
echo"上传成功";
$link=mysql_connect("localhost","root");
mysql_select_db("wdn",$link);
$query="insert into img(img,img_jj) values('$wen','$img_jj')";
if(mysql_query($query))
{
echo"<br>";
echo "数据存储成功";
echo"<br>";
echo "<img src='".$wen."'>";
}
}
?>
imgshow.php
-------------
<html>
<head>
<title>图片展示</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
$link=mysql_connect("localhost","root");
mysql_select_db("wdn");
$pd=mysql_query('select * from img',$link);
$i=0;
echo"<table width='700' border='0' cellspacing='20'>";
echo"<tr>";
while($array=mysql_fetch_array($pd))
{
$i++;
echo"<td width='150'> ";
echo"<table width='150' border='1' bordercolor='#0099FF'>";
echo"<tr>";
echo"<td width='150'><font size='2'><a href='".$array[img]."'><img src='".$array[img]."' width='150' border='0' alt='ID:".$array[img]."' ></a></font></td>";
echo"</tr>";
echo"<tr> ";
echo"<td width='150'><font size='2'>图片简介:".$array[img_jj]."</font></td>";
echo"</tr>";
echo"</table>";
echo"</td>";
if($i%4=="0")
{
echo"</tr>";
}
}
echo"</table>";
?>
</body>
</html>
数据库:
------
CREATE TABLE img (
img varchar(15) default NULL,
img_jj varchar(100) default NULL
) TYPE=MyISAM; http://topic.csdn.net/t/20020518/02/731921.html