Home > Backend Development > PHP Tutorial > 当执行mysql insert 时插入两条是咋回事

当执行mysql insert 时插入两条是咋回事

WBOY
Release: 2016-06-13 12:41:42
Original
1422 people have browsed it

当执行mysql insert 时插入两条是怎么回事?

本帖最后由 Eason_____________ 于 2013-07-25 11:25:44 编辑 //做了一个手机上传图片到服务器的功能。但是获取到执行insert语句时都要执行两次!

//index.php
<br />
<?php<br />
header("Content-Type: text/html; charset=UTF-8");<br />
mysql_connect("localhost","dome_huayan","e2k3e6b8");<br />
mysql_select_db("dome_huayan");<br />
mysql_query("set names utf8");<br />
<br />
include 'uploadImage.php';<br />
$gettitle=$_GET['title'];<br />
$getcontent=$_GET['content'];<br />
$i = new uploadImage($_FILES['filename'],'./img/');<br />
$i->doWork();<br />
$i->imageCheck();<br />
<br />
$sql="insert into json_bbs values('','".$gettitle."','".$getcontent."','".$i->iamgePath."','".time()."','')";<br />
mysql_query($sql);<br />
?><br />
Copy after login


//uploadImage.php

<br>
<?php <br />
/**<br>
 * <br>
 * 图片上传类<br>
 * @author ChenYue<br>
 *<br>
 * @param $mageStauts                 图片上传状态 1为正常状态<br>
 * @param $iamgePath                  图片上传成功保存在数据库的路径<br>
 * @param $imagePathTemp              临时保存图片上传成功保存在数据库的路径<br>
 * @param $destination_folder 	      上传文件路径<br>
 * @param $imageName                  上传的图片名(可自定义)<br>
 * @param $fileArray                  上传的图片信息数组<br>
 * @param $updateImage                判断是否更新原有图片 0表示不更新 , 1 表示更新<br>
 * @param $uptypes                    支持上传的图片类型<br>
 * @param max_file_size               支持上传的图片最大类型<br>
 * @param imageType                   图片的类型<br>
 * <br>
*/<br>
class uploadImage{<br>
	<br>
	public $imageStauts = 1;<br>
	public $iamgePath=''; <br>
	public $imagePathTemp = "";<br>
	private $destination_folder; <br>
	private $imageName; <br>
	private $fileArray;<br>
	private $updateImage = 0; <br>
	private $uptypes = array(<br>
    'image/jpg', <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template