#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Unexpected string


    Wht the error on the prepare statement?

    PHP Code:
    <?php 
    include_once ('connect.php');
    session_start();
    $username $_SESSION['username'];

    if (isset(
    $_FILES["avatar"]["name"]) && $_FILES["avatar"]["tmp_name"] != ""){
                
    header("location: ../message.php?msg=ERROR: photos ");
                
    $fileName $_FILES["avatar"]["name"];
                    
    $fileTmpLoc $_FILES["avatar"]["tmp_name"];
                
    $fileType $_FILES["avatar"]["type"];
                
    $fileSize $_FILES["avatar"]["size"];
                
    $fileErrorMsg $_FILES["avatar"]["error"];
                
    $kaboom explode("."$fileName);
                
    $fileExt end($kaboom);
                list(
    $width$height) = getimagesize($fileTmpLoc);
                if(
    $width 10 || $height 10){
                
    header("location: ../message.php?msg=ERROR: That image has no dimensions");
                        exit();    
                }
            
                echo 
    $db_file_name;
                if(
    $fileSize 1048576) {
                
    header("location: ../message.php?msg=ERROR: Your image file was larger than 1mb");
                exit();    
                } else if (!
    preg_match("/\.(gif|jpg|png)$/i"$fileName) ) {
                
    header("location: ../message.php?msg=ERROR: Your image file was not jpg, gif or png type");
                exit();
                } else if (
    $fileErrorMsg == 1) {
                
    header("location: ../message.php?msg=ERROR: An unknown error occurred");
                echo 
    'exited';
                exit();
                }
    }
    $stmt $db->prepare(""SELECT avatar FROM members WHERE username=:username LIMIT 1");
    $stmt->bindValue(':username',$username,PDO::PARAM_STR);
    try{
    $stmt->execute();
    }
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    You have one too many quotation marks in the line.

    Also you can't have a try block without a catch.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo