move_uploaded_file() script not completing
<p>My PHP script is as follows:</p>

<pre><code>&lt;?php

require_once('connectvars.php');

$file = $_FILES['image']['name'];
$target = GW_UPLOADPATH . $file;

if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
    $dbc = mysqli_connect(DB_HOST, DB_UN, DB_PW, DB_NAME) or die('Error connecting to the MySQL server');

    $title = mysqli_real_escape_string($dbc, trim($_POST['title']));
    $description = mysqli_real_escape_string($dbc, trim($_POST['content']));
    $host = mysqli_real_escape_string($dbc, trim($_POST['host']));
    $duration = mysqli_real_escape_string($dbc, trim($_POST['duration']));
    $sn1 = mysqli_real_escape_string($dbc, trim($_POST['link1']));
    $sn2 = mysqli_real_escape_string($dbc, trim($_POST['link2']));
    $sn3 = mysqli_real_escape_string($dbc, trim($_POST['link3']));
    $sn4 = mysqli_real_escape_string($dbc, trim($_POST['link4']));
    $sn5 = mysqli_real_escape_string($dbc, trim($_POST['link5']));

    $query = "INSERT INTO dyhamb (title, description, host, duration, file, sn1, sn2, sn3, sn4, sn5 ) VALUES ('$title', '$description', '$host', '$duration', '$file', '$sn1', '$sn2', '$sn3', '$sn4', '$sn5')";
    $result = mysqli_query($dbc, $query);

    if (!$result) {
        echo 'failed';
    } else {
        echo 'success';
    }

    mysqli_close($dbc);
}
?&gt;
</code></pre>

<p>When I run the script I am getting 'failed' returned and I cannot work out why. Both <code>$dbc</code> and <code>$query</code> appear to be fine, therefore not sure why <code>$result</code> isn't defined.</p>
