Jump to content

php variables inside variables


searls03

Recommended Posts

do you see anything wrong in this code.....all of the sudden it stopped posting to database......

 

<?php
include_once "secure/connect_to_mysql.php";

$uploaddir = 'images/';
$id= $_GET['id'];
$event= $_GET['name123'];

$site = "{$event}.php";
$file = $uploaddir . basename($_FILES['uploadfile']['name']); 
$size=$_FILES['uploadfile']['size'];
if($size>999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)
{
echo "error file size > 1 MB";
unlink($_FILES['uploadfile']['tmp_name']);
exit;
}
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { 
  echo "success"; 
} else {
echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)";
}

$sql = "INSERT INTO pictures(image, id, event) 
	VALUES('$file', '$id', '$event')";
$rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error());
	echo mysql_error();


?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.