Click to See Complete Forum and Search --> : Unknown table error


cwilkey
11-14-2005, 10:55 AM
Greetings. I'm trying to upload a file and then send the filename to a database. I'm getting an "Unkown tabe '' " error.

Can someone take a look?


<?php require_once('Connections/QNIsite.php'); ?>
<?php
$ID = $_GET['ID'];
$image = $_FILES['image']['name'];
$uploadDir = 'Images/';
$uploadFile = $uploadDir . $_FILES['image']['name'];

move_uploaded_file($_FILES['image']['tmp_name'], $uploadFile);
?>
<form enctype="multipart/form-data" action="upload_image.php?ID=<? echo $ID ?>" method="post">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="500000000" />
Choose a file to upload: </p>
<p>
<input name="image" type="file" />
</p>
<p>
<input name="submit" type="submit" value="Upload File" />
</p>
</form>
<?php
if ($_POST['submit'] == "Upload File"){
$updateSQL = "UPDATE articles SET image = $image WHERE ID=$ID";
mysql_select_db($database_QNIsite, $QNIsite);
$Result1 = mysql_query($updateSQL, $QNIsite) or die(mysql_error());
header("Location: /Admin/News/edit.php?ID=<?php echo $ID ?");
}
print $updateSQL;
?>

NogDog
11-14-2005, 11:34 AM
Is there, in fact, a table named "articles" in the database, spelled exactly that way all in lower-case letters?

Also, once that is straightened out, you'll probably find that you need to put quotes around '$image' in the SQL, and possibly also around '$ID' if it is not a number.

cwilkey
11-14-2005, 11:38 AM
Yep...the single quotes is what did it.

Thanks!