Thread: PHP Update
View Single Post
  #1 (permalink)  
Old 07-05-09, 11:09 AM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Update

Form:

PHP Code:
<?php
session_start
();
require (
"connect.php");
require(
"functions.php"); 
include(
"template/header.php");
if(
$_SESSION['status'] != 2){
    die(
'You must be an administrator to access this section; please <a href="login.php">login</a>');
}
echo 
"<a href=\"admin.php\">Return to admin section!</a></br><br/><br/>";
echo 
"Here you can add thumbnails.";
echo 
"<br/>Add a Thumbnail:<br/><br/>";
    echo 
"<form action=\"thumbnail.php\" method=\"post\" enctype=\"multipart/form-data\">";
    echo 
"<select name=\"title\">";
    
$result mysql_query("SELECT * from layouts WHERE id ORDER BY `title` ASC");
    while(
$list mysql_fetch_array$result )){
    
$title $list['title'];  
    
$cid $list['id'];
    echo 
"<option value=\"$cid\">$title</option>";
    }
    echo 
"</select>";
    echo 
"<br/>Display image (100px x 100px): <input id=\"file\" type=\"file\" name=\"file\"/><br />";
        echo 
"<br/><input type=\"submit\" name=\"submit\" value=\"Create thumbnail!\">
        </form>"
;
       
include(
"template/footer.php");
?>
Thumbnail.php:

PHP Code:
<?php
session_start
();
require (
"connect.php");
require(
"functions.php"); 
include(
"template/header.php");
if(
$_SESSION['status'] != 2){
    die(
'You must be an administrator to access this section; please <a href="login.php">login</a>');
}
      
$rand rand(0,999999);
      
move_uploaded_file($_FILES["file"]["tmp_name"], "http://www.hotscripts.com/forums/images/" "$rand" $_FILES["file"]["name"]);
      
$thumbnail "$rand" $_FILES["file"]["name"];
      if(empty(
$_FILES["file"]["name"])){
          
$thumbnail "none.jpeg";
}
    
$id mysql_real_escape_string($_GET['id']);
    
$result mysql_query("UPDATE layouts SET thumbnail = '$thumbnail' WHERE id='$id'");
        echo 
"The thumbnail has been added.";
        echo 
"$title";
        
include(
"template/footer.php");
?>
I'm trying to update a database with the image i have uploaded however nothing updates? What am I doing wrong?
Reply With Quote