SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Unlinking image from directory
-
May 26, 2003, 11:49 #1
Unlinking image from directory
Hey,
I develop my to code unlink the image from the directory it sits in,
and I also have it delete the information from the database. The only
problem that exist so far is a stupid parse error. I look over the code,
and not sure what is the probem. It be appreciated if some one can
help out.
PHP Code:<?php
include ('../../config/one_config.php');
$dbcnx=@mysql_pconnect($localhost,$username,$password);
if (!$dbcnx){
echo ("<p> Unable to Connect to the" .
"Link Center at this time.</p>");
exit();
}
mysql_select_db($linkdb);
$main=@mysql_query("SELECT * FROM linkage WHERE id=$id");
if (!$main) {
echo("<p>Error fetching details: " .
mysql_error() . "</p>");
exit();
}
$r = mysql_fetch_array($main);
$id=$r["id"];
$name=$r["name"];
$url=$r["url"];
$totalcount=$r["totalcount"];
$todaycount=$r["todaycount"];
$timestamp=$r["timestamp"];
$created=$r["created"];
$picname=$r["picname"];
$email=$r["email"];
$ok1 = unlink("/wwwrooot/One/lk_image/$r[picname]");
if ($ok1) {
echo("<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Remove file succesfully from folder</font></p>");
}else{
echo("<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing File!<br />" .
"Error" . mysql_error() . "</font></p>");
exit();
$ok2 = @mysql_query("DELETE FROM linkage where id=$id");
if ($ok2) {
echo("<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Link deleted succesfully!</font></p>");
} else {
echo("<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing from Database!<br />" .
"Error" . mysql_error() . "</font></p>");
}
?>
</p>
<p><a href="../../links.php" class="link">Return to Link List</a></p>
</body>
</html>
Code:Parse error: parse error in E:\Inetpub\wwwroot\One\controlone\admin\Link_files\deletelink.php on line 60
OneX Square Creation
One man said Why ? ... Another man said Why not ?
-
May 26, 2003, 12:15 #2
- Join Date
- Dec 2002
- Location
- United States of America
- Posts
- 349
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Which one is line 60?
-
May 26, 2003, 12:23 #3
Line 60 is
</html>OneX Square Creation
One man said Why ? ... Another man said Why not ?
-
May 26, 2003, 12:58 #4
- Join Date
- Dec 2002
- Location
- United States of America
- Posts
- 349
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ah.
PHP Code:$ok1 = unlink("/wwwrooot/One/lk_image/$r[picname]" );
if ($ok1) {
echo("<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Remove file succesfully from folder</font></p>" );
} else {
echo("<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing File!<br />" .
"Error" . mysql_error() . "</font></p>" );
exit();
}
$ok2 = @mysql_query("DELETE FROM linkage where id=$id" );
if ($ok2) {
echo("<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Link deleted succesfully!</font></p>" );
} else {
echo("<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing from Database!<br />" .
"Error" . mysql_error() . "</font></p>" );
}
-
May 26, 2003, 13:22 #5
Ya that work.
Well since that work there is always another problem.
$ok1 works fine, but $ok2 fails to delete the information from the database. Anyone can help me re-approach this ?
ThanksOneX Square Creation
One man said Why ? ... Another man said Why not ?
-
May 26, 2003, 19:56 #6
-
May 26, 2003, 20:49 #7
Error message is this :
Remove file succesfully from folder
Error Deleteing from Database!
Error
The first line stating "remove file..." is variable $ok1 and the second is $ok2
OneX Square Creation
One man said Why ? ... Another man said Why not ?
Bookmarks