Hi all,
Hopefully simpe this one. The html after the php is not displaying currently, any ideas?
<?php
include_once("../../private/supplierconfig.php");
checkLoggedIn("yes");
error_reporting (E_ALL);
echo "Welcome $username, ";
//Retrieve details from database to start
$id = $_SESSION['username'];
$query = "select image1, username from suppliers where username='$id'";
//now we pass the query to the database
$result=mysql_query($query, $link) or die("MySQL query $query failed. Error if any: ".mysql_error());
//get the first (and only) row from the result
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$username=$row['username'];
$image1 = $row['image1'];
if(isset( $submit ) )
{
// exit;
//move image1 to the delete folder.
rename ("files/".$image1, "temp/".$image1)
or die ("Could not delete");
//set image1 back to NULL
$image1 = 'NULL';
$query = "UPDATE `suppliers`
SET `image1` = '$image1' WHERE `username` = '". mysql_real_escape_string($_SESSION['username']). "'
LIMIT 1";
$result = mysql_query($query, $link) or die('Update failed: ' . mysql_error());
echo $query;
//print_r($query);
mysql_info($link) ;
if(mysql_affected_rows($link) == 0);
//header("Location: suppliers.php?".session_name()."=".session_id());
}
else {
echo "";
exit;
}
?>
<html>
<body>
<form>
<form action="<?=$_SERVER["PHP_SELF"]?>" method="POST">
<table>
<tr><td> </td><td><input name="submit" type="submit" value="Submit"></td></tr>
</table>
</form>
</body>
</html>