0
A
回答
1
是的,這是可能的。二進制字符串將保存數據就好了。
編輯:下面是一個例子
CREATE TABLE fooblob (
id INT AUTO_INCREMENT ,
data MEDIUMBLOB,
PRIMARY KEY (id)
) ENGINE = InnoDB;
$dbh = mysqli_connect('localhost', 'my_user', 'my_password', 'world');
# Read a blob
if(!$res = mysql_query("SELECT data FROM fooblob WHERE id = 1", $dbh)) {
die("ERROR: " . mysql_error());
}
$row = mysql_fetch_assoc($res);
$data = $row['data'];
# Write it to a different row (pretend it's a different table)
$stmt = mysqli_prepare($dbh, "INSERT INTO fooblob(data) VALUES (?)");
mysqli_stmt_bind_param($stmt, 's', $data);
mysqli_stmt_execute($stmt);
+0
這是怎麼回事? – 2013-05-05 17:12:11
0
可以這樣嗎?
1)
$dbh = mysqli_connect('localhost', 'my_user', 'my_password', 'world');
# Read a blob
if(!$res = mysql_query("SELECT data FROM fooblob WHERE id = 1", $dbh)) {
die("ERROR: " . mysql_error());
}
$row = mysql_fetch_assoc($res);
$data = $row['data'];
2)
<textarea name="test" id="test"><?= $data ?></textarea>
3)
$post_data = $_POST['test'];
$dbh = mysqli_connect('localhost', 'my_user', 'my_password', 'world');
if(!$res = mysql_query("INSERT INTO fooblob (data) VALUES ('$post_data') WHERE id = 1", $dbh)) {
die("ERROR: " . mysql_error());
}
相關問題
- 1. 如何將圖像從一個域保存到另一個域
- 2. 保存圖像導出到另一個
- 3. 試圖將數據從一個形式存儲到數據庫中使用PHP
- 4. 如何將視圖從一個數據庫複製到另一個數據庫
- 5. 將列數據從一個數據庫傳輸到另一個
- 6. 將一列數據從一個數據庫複製到另一個數據庫
- 7. 使用PHP將信息從一個表保存到另一個表中
- 8. 如何將圖像加載到一個div中,哪個圖像從數據庫加載到另一個div
- 9. 用php將一些數據從一個數據庫轉移到另一個數據庫?
- 10. 如何使Django ImageField將圖像保存到另一個模型?
- 11. 如何使用SQLite和PHP將圖像保存到數據庫?
- 12. 將UIButton從一個圖像動畫到另一個圖像
- 13. 將數據從一個數據庫傳輸到另一個數據庫
- 14. 將數據從一個數據庫傳輸到另一個數據庫
- 15. 將特定數據從一個數據庫移動到另一個數據庫
- 16. 將數據從一個數據庫複製到另一個數據庫
- 17. 將數據從一個數據庫遷移到另一個數據庫
- 18. 將數據從一個數據庫複製到另一個數據庫
- 19. 將表格數據從一個數據庫複製到另一個數據庫
- 20. 將數據從一個數據庫表複製到另一個數據庫表?
- 21. 將數據從一個數據庫複製到另一個數據庫
- 22. Django:將數據從一個數據庫複製到另一個數據庫
- 23. 將數據從一個數據庫複製到另一個數據庫
- 24. MySql - 從一個數據庫更新到另一個數據庫
- 25. 將javascript保存到一個mysql數據庫+複製一個dataURL
- 26. 將BLOB圖像從PHP中的數據庫保存到磁盤
- 27. 將標量函數從一個數據庫複製到另一個數據庫
- 28. Yii 2:使用保存的數據表的值將數據保存到一個表後填充另一個表
- 29. 將數據庫從一個SQL Server複製到另一個
- 30. 將三列從一個數據庫表複製到另一個
你保存路徑或實際的文件? – SomeShinyObject 2013-05-05 13:47:12
是的,這是可能的。 – bestprogrammerintheworld 2013-05-05 14:43:57
我保存實際的文件...這是怎麼回事? – 2013-05-05 16:20:35