 


test1.php:

<?php
 header("Content-type:text/html;charset=UTF-8");
  $a=mysql_connect("localhost", "root", "");

 $link = mysql_select_db("cty_test",$a);
  
  $sql="CREATE TABLE image_sql(ID int Not Null AUTO_INCREMENT, primary key(ID), ImageName varchar(30), Image blob)";
  mysql_query($sql, $a);
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(1, 'IPHONE车展名模', 'images/29.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(2, 'IPAD案例演示', 'images/48.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(3, 'IPAD日历演示', 'images/49.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(4, 'IPAD杂志演示', 'images/50.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(5, 'IPAD游戏演示', 'images/52.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(6, '疯狂农场', 'images/53.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(7, '虚拟社区商场', 'images/54.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(8, '脸谱拼图', 'images/55.jpg')");

mysql_query("insert into image_sql(ID, ImageName, Image)
  values(8, '脸谱拼图', 'images/56.jpg')");
  
 mysql_query("insert into image_sql(ID, ImageName, Image)
  values(8, '脸谱拼图', 'images/57.jpg')");
  
 mysql_close($a);
  
 ?>
  

test2.php:

<?php
 header("Content-type:text/html;charset=UTF-8");
  $a=mysql_connect("localhost", "root", "");
  if(!$a)
  {
  die(mysql_error());
  }
  mysql_select_db("cty_test", $a);
  $b=mysql_query("select * from image_sql");
  
 while($c=mysql_fetch_array($b))
  {
  echo $c['ImageName']."<img src=/myphp_test/".$c['Image']." />";
  echo "<br />";
  }
  mysql_close($a);
  
 ?>
