PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
hi, i have this code for upload and it will successfully upload the file remotely, however, i cant make it to work when it comes to posting some data in the database.
if (isset($_POST['upload'])) {
$target = "../uploads/";
$target .= $_FILES['uploaded']['name'];
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
$query = "SELECT a.UserKey, a.UserRightsKey, b.level_key, b.level_description
FROM ext_Users a
INNER JOIN ext_UserRights b ON (a.UserRightsKey = b.level_key)
WHERE a.UserKey = '" . $_SESSION['UserKey'] . "'";
$result = mysql_query($query) or die(mysql_error());
if ($result) {
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
if ($row[3] == "Developer") {
$query1 = "INSERT INTO ext_WebReleases(Description)
VALUES('sample text')";
$result1 = mysql_query($query1) or die(mysql_error());
if ($result1) {
echo "<b>Successfully uploaded the application.</b><br/>";
} else {
echo "<b>Could not upload the application.</b>";
}
}
}
}
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else if(!$_FILES['uploaded']) {
echo "Sorry, there was a problem uploading your file.";
}
}
when i test that code, the message will say "successfully uploaded the application" but the text inside the Description table will not appear. please help me.