Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts

    T_VARIABLE When adding the Query string.

    I'm getting:
    Parse error: syntax error, unexpected T_VARIABLE in /home/jiingo/public_html/upload.php on line 39

    When I add the $query2, and $result2 lines below. Otherwise my script is working fine. Is there something I'm missing? They don't seen to be interfering with anything else in the code.

    This is also the major part of the code, but there are a few other bits and pieces above this part which I can provide, although I don't think they are important (but could be i suppose!)

    PHP Code:
    <?
    define 
    ("DIRECTORY""/home/jiingo/public_html/photos/$row[vardir]/$session->username/");

    do {
       
    $dir DIRECTORY;
       while (!
    is_dir($dir)) {
           
    $basedir dirname($dir);
           if (
    $basedir == '/' || is_dir($basedir))
               
    mkdir($dir,0777);
           else
               
    $dir=$basedir;
       }
    } while (
    $dir != DIRECTORY);
                    
            
    $picname $_FILES['userfile']['name'];
            
    $random=rand(100000,999999);
            
    $newpicname=$random.$picname;
            
    $uploadfile $dir.$newpicname;            
            
    move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);
    CHMOD("$uploadfile"0777)

    $query2 "INSERT INTO photo_manager SET filename='$newpicname'";
    $result2=mysql_query($query2)        
                    
    ?>

  • #2
    Regular Coder anarchy3200's Avatar
    Join Date
    Mar 2003
    Location
    England
    Posts
    261
    Thanks
    0
    Thanked 1 Time in 1 Post
    Well to start with your missing a semi-colon after
    Code:
    $result2=mysql_query($query2)
    and also one after
    Code:
    CHMOD("$uploadfile", 0777)
    It could be them.
    Last edited by anarchy3200; 06-15-2006 at 06:27 PM.
    Mike

  • #3
    New Coder
    Join Date
    Sep 2004
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by anarchy3200
    Well to start with your missing a semi-colon after
    Code:
    $result2=mysql_query($query2)
    It could be that.
    It was the CHMOD!

    Thanks! I'm still really new to PHP - but learning slowly! So it's hard for me to catch my errors sometimes.
    Last edited by shanparker; 06-15-2006 at 06:28 PM.

  • #4
    Regular Coder anarchy3200's Avatar
    Join Date
    Mar 2003
    Location
    England
    Posts
    261
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thats fair enough, that is why there are people here to help!
    Mike


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •