Thread: Mysql Poop
View Single Post
  #3  
Old 10-03-2007, 10:19 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
Still didn`t update the MYSQL table. I dunno why...this is the script...

PHP Code:
<?php 
include ("config.php");

$title=$_REQUEST["title"];
$description=$_REQUEST["description"];
$currentuser=$_REQUEST["username"];

$number="0";
$anothernumber="0";
$date=date("m-j-y"); 


    if (
$_REQUEST["category1"] != "other")
    {
    
$category1=$_REQUEST["category1"];
    }
    else
    {
    
$category1=$_REQUEST["othertext"];
    }

    
mysql_query("INSERT INTO `tutorials` (`title`, `description`, `date`, `category1`, `approved`) VALUES ('$title', '$description', '$date', '$category1', 'no');") or die ("<br /><br />Mysql Error: ".mysql_error());
    
mysql_query("INSERT INTO `tutoriallinks` (`title`, `description`, `approved`,`date`, `category1`,`user`) VALUES ('$title', '$description', 'no','$date', '$category1', '$currentuser');") or die ("<br /><br />Mysql Error: ".mysql_error());
    
$tutorialid=mysql_insert_id();


    while (
$step[$number])
    {
      
$stepnumber=$number+1;
      
mysql_query("UPDATE tutorialsteps SET thestep='$step[number]' WHERE stepnumber='$stepnumber' AND tutorialnumber='$tutorialid'") or die ("<br /><br />Mysql Error: ".mysql_error());
      print 
$step[$number];
      
$number++;
    }


      
$theid=$tutorialid;
      
$number2="0";

  if (
$_FILES["ourFiles"]!="")
  {
    foreach (
$_FILES["ourFiles"]["error"] as $key => $error) {
      if (
$error == UPLOAD_ERR_OK)
      {
       
$tmp_name $_FILES["ourFiles"]["tmp_name"][$key];
       
$keynumber=$key 1;
       
$name $_FILES["ourFiles"]["name"][$key];
       
$name=strtolower($_FILES["ourFiles"]["name"][$key]);
       
$ext=substr(strrchr($name"."), 1);
       
$name="review"."_".$theid."_".$keynumber."."."$ext";
       
mysql_query("INSERT INTO `tutorialfiles` (`tutorialnumber`, `stepnumber`, `thefile`) VALUES ('$tutorialid', '$keynumber', '$name');") or die ("<br /><br />Mysql Error: ".mysql_error());
       
move_uploaded_file($tmp_name"./uploads/$name");
       
$iRedirURL="./tutorials.php?view=tutorial&sid=$tutorialid";
      }

    }
  }

    
?>
__________________
Reply With Quote