文件上传图片写入数据库中:转码,从数据库读取怎么代码啊  。

解决方案 »

  1.   

    你转码存入数据库,读出来就要解码咯,    PHP上传图片,在数据里面只要存入图片名称,名称可以用随机数加进去,网上有很多例子,你可以去找找看
      

  2.   

    二进制addslashes以后''引起来插入, 读的时候直接读到就是原先数据.
      

  3.   

    我写出来注册页面无法连接数据库怎么回事
    <?php
    $username=$_POST['username'];
    $password=$_POST['password'];
    $password=$_POST['password1'];
    $email=$_POST['email'];
    if(empty($username)||empty($password)||empty($password1)||empty($email)){
        echo'<script>alter("注册中的每一项必须填写!")</script>';
      }
      if($password!=$password1){
          echo'<script>alter("两次输入的密码不一致")</script>';
                                                 }
    else{
          if(empty($password)){
           echo'<script>alter("密码不能为空")</script>';
                                   }
    else
    {
    $sql="insert into users(username,password,email) VALUES('$username','$password','email')";
    $rs=mysql_query($sql);
        if($rs)
        {
                     header('location: ./landing.php');
         }
    }
    }?>
    <html>
      <head>
       <title>表单注册</title>
      </head>
        <body>
     <p align="center">用户注册</p>
     <form action="register.php" method="POST">
       <table width="650" border="0" align="center" cellspacing="1" bgcolor="red">
        <tr bgcolor="lavender">
        <td>博客昵称:</td>
     <td colspan="2"><label><input type="username" name="username" ></label>*4~20为小写字母、数字或汉字(汉字算两位)组成</td>
     </tr>
      <tr bgcolor="lavender">
     <td>登陆密码:</td>
     <td colspan="2"><label><input type="password" name="pssword" ></label>*6~10为字符(字母、数字、符号)区分大小写</td>
     </tr>
     <tr bgcolor="lavender">
     <td>确认密码:</td>
         <td colspan="2"><label><input type="password" name="password1" ></label>*请输入与上一次相同的登录密码</td>
      </tr>
       <tr bgcolor="lavender">
      <td>邮箱:</td>
       <td colspan="5"><label><input type="text" name="email">*请输入常用的邮箱地址</label></td>
       </tr>
     <tr>
      <tr bgcolor="lavender">
      <td>&nbsp;</td>
      <td width="212"><input type="submit" name="submit" value="提交">
     </td>
     <td width="250"><input type="submit" name="submit" value="取消">
     </td>
     </tr>
    <tr>
         </label>
     </form>
         </body>
        </html>
      

  4.   

    不知道你有没有链接sql的语句,插入之前应该有没有关闭的数据库链接。
    还有$sql="insert into users(username,password,email) VALUES('$username','$password','email')";
    红色那是啥东西,应该$email吧
      

  5.   

    哦哦    我写出来注册页面无法连接数据库怎么回事
    $sql="insert into users(username,password,email) VALUES('$username','$password','$email')";这句话是这样的
      

  6.   

    那 mysql_connect 在哪里?
      

  7.   

    我是写在include('conn.php')中的  发到这上面的这个没用  我昨天重加了一次还是没法
      

  8.   

    <?php
    $conn=@mysql_connect('localhost','root','')or die ('数据库连接失败');
    mysql_select_db('blog',$conn);
    mysql_query('set names utf8');
    ?>
    连接数据库的代码