View Single Post
Old 05-23-2009, 10:04 AM   #4 (permalink)
kmote
 

Join Date: Jul 2005

Location: England

Posts: 2,185

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: my image upload please

This highlights perfectly the need to lay code out properly. Another tip is to keep language code and functions out of things like SQL queries. This is your code but laid out differently:
Code:
$whoKnows = 0 + $_POST["type"];

$searchText = implode(",",
	array_map("sqlesc",
		array(searchfield("$shortfname $dname $torrent"),
			$fname,
			$uploaderid,
			"no",
			$infohash,
			$torrent,
			$totallen,
			count($filelist),
			$type,
			$descr,
			$descr,
			$inames[0],
			$inames[1],
			$whoKnows,
			$dname)));

$queryTime = get_date_time();

$sql = <<<EOT
	INSERT INTO books(
		search_text,
		filename,
		owner,
		visible,
		info_hash,
		name,
		size,
		numfiles,
		type,
		descr,
		ori_descr,
		image1,
		image2,
		category,
		save_as,
		added,
		last_action,
		nfo,
		comm_enabled,
		cover)
	VALUES(
		$searchText,
		$queryTime,
		$queryTime,
		$nfo,
		$comm_enabled,
		$cover)
EOT;

$ret = mysql_query ($sql);

__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline