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!
if (isset($_POST['submit'])) {
$query="UPDATE business_info SET
`Picture3` = '".$_POST[$fullpath3]."' WHERE Password='".$_SESSION['Password']."'";
Does your form have an input named 'submit'? If so, then I'm guessing $_POST[$fullpath3] is blank because you're using $fullpath3 to store the path to the file (you use it a few lines up).
$_POST[$fullpath3] is actually looking for $_POST["/home/townsfin/public_html/business_images/" . $_FILES['Picture3']['name']], which I'm sure doesn't exit.
mass-ad.com01
_SESSION:Array
(
[User_Name] => franklin
[Password] => franklin01
[test1] => This is test1 session variable
[test2] => This is test2 session variable
)
UPDATE business_info SET `Picture3` = '' WHERE Password='franklin01'
<?php
// Lets get some error information shall we?
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
// This really needs to be reevaluated.
// This should be throwing undefined index
// errors if called without a file upload
if ($_FILES['Picture3']) {
$moved3 = false;
}
// Define the path
define ("UPLOADDIR", "/home/townsfin/public_html/business_images/");
if (is_uploaded_file($_FILES['Picture3']['tmp_name'])) {
$fullpath3 = UPLOADDIR . $_FILES['Picture3']['name'];
echo 'Is uploaded file seemed to return true. $fullpath3 is set to ' . $fullpath3 . '<br /><br />';
}
if (move_uploaded_file($_FILES['Picture3']['tmp_name'],$fullpath3)) {
$moved3 = true;
echo "picture $fullpath3 uploaded";
echo 'Move uploaded file seemed to return true. $fullpath3 is set to ' . $fullpath3 . '<br /><br />';
}
if (isset($_POST['submit'])) {
echo 'The form submit field is set.<br /><br />';
$query = "UPDATE business_info
SET `Picture3` = '$fullpath3'
WHERE Password = '{$_SESSION['Password']}'";
$result = mysql_query($query) or die ("Problem with the query: <pre>$query</pre><br>" . mysql_error());
if (mysql_affected_rows()) {
echo 'The update took!';
} else {
echo 'The update did not take using SQL: ' . $query;
}
}
?>