close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
Are you an avid runner? Or even just starting out?

Brooks designs high-performance men's and women's running shoes, apparel and accessories.
From our sponsors
php程式碼錯誤
Aug 13th 2013, 04:15

以下是完整的php程式碼:
我的目的是要"對應MySQL裡儲存的路徑, 將指定的檔案複製至指定的目錄 "
有試過在同一目錄下複製, 完全沒問題
但使用MySQL裡的路徑時, 就錯誤,,,
想請問大大們 是錯在哪裡?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title> 對應MySQL的路徑,將指定的檔案複製至指定的目錄 </title>
</head>
<body>
<?php
mysql_connect("localhost", "root", "phpmysql") or die (" 無法連結主機 ");
mysql_select_db("IMAGE") or die (" 無法連結資料庫 ");
$sql2="select * from imagea";
$sql3=mysql_query($sql2);

while($list2=mysql_fetch_array($sql3))
{
$address=$list2['address'];
$day_and_time=$list2['day_and_time'];
}

//echo "" ."<br>";
echo "address: ".$address."<br>";       //顯現結果為"address: \new\test\ "
echo "day_and_time:".$day_and_time."<br>"; //顯現結果為"day_and_time:19920826000102 "

$oldfile=$address;//要複製的檔案
$newfile=abc.jpg;//目的檔案
$a=$address.$day_and_time.".jpg";

echo $a."<br>";//顯現結果為" \new\test\19920826000102.jpg "
$isok=copy($a,$newfile);//複製成功傳回 true,反之 false

if(isok==true)
{
echo "檔案複製完成!";//顯示成功訊息
}else{
echo "檔案複製失敗...";//顯示失敗訊息
}

?>
</body>
</html>

網頁顯現的錯誤訊息:

address: \new\test\
day_and_time:19920826000102
\new\test\19920826000102.jpg
Warning: copy(\new\test\19920826000102.jpg) [function.copy]: failed to open stream: No such file or directory in C:\AppServ\www\new\copy2.php on line 29
檔案複製完成!

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 kkoxhcfqr4v4f 的頭像
    kkoxhcfqr4v4f

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

    kkoxhcfqr4v4f 發表在 痞客邦 留言(0) 人氣()