|
 |
|
การทำ Drag and Drop ดึงภาพจากดาต้าเบสมาแสดงไม่ได้ค่ะ |
|
 |
|
|
 |
 |
|
จากลิ้งนี้ค่ะ http://trewelu.itn.ac.id/arsip/pcd-sederhana-menggunakan-php-jquery-dan-css3.cgi
ในส่วนท้ายได้ทำการ insert ให้เก็บลงดาต้าเบสค่ะ
$sql = "INSERT INTO map (IDlogbook, mapPic) VALUES ('".$_POST["IDlogbook"]."', '".$_POST["jsondata"]."')";
$result = mysql_query($sql);
//// ตรงนี้ เก็บค่า '".$_POST["jsondata"]."' ถูกต้องรึป่าวคะ จากในลิ้งด้านบน ตัวอย่างเค้าเก็บค่าฟอร์มแบบนี้ค่ะ
<form id="jsonform" action="merge.php" method="POST">
<input id="jsondata" name="jsondata" type="hidden" value="" autocomplete="off"></input>
</form>
และสงสัยว่าในดาต้าเบส ควรจะเก็บเป้น blob หรือ varchar คะ
คือสร้างฟิลชื่อ mapPic และลองเก็บเป็นค่า varchar ดู มันแสดงข้อมูลที่เก็บออกมาแบบนี้ค่ะ
{"images":[{"id":"obj_0","src":"background.jpg","width":"480","height":"320"},{"id":"icon2","src":"images/icon_2.png","width":43,"height":15,"top":74,"left":234,"rotation":"0"},{"id":"icon6","src":"images/icon_6.png","width":31,"height":31,"top":62,"left":308,"rotation":"0"},{"id":"icon14","src":"images/i14.png","width":40,"height":40,"top":65,"left":356,"rotation":"0"},{"id":"icon15","src":"images/i15.png","width":40,"height":40,"top":105,"left":303,"rotation":"0"}]}
เลยอยากจะถามว่าเวลาดึงจากดาต้าเบสมาแสดงผลให้เป็นภาพ ควรใช้คำสั่งอะไรคะ
<img src="<?=$objResult["mapPic"];?>">
ก็ไม่แสดงภาพค่ะ
ขอบคุณค่ะ
Tag : PHP, MySQL, jQuery

|
|
 |
 |
 |
 |
Date :
2012-02-17 20:57:29 |
By :
yim |
View :
1041 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ json_decode แล้วจะได้ array มาใช้ครับ ลองอ่านดูก่อน
|
 |
 |
 |
 |
Date :
2012-02-17 22:50:08 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำได้เรียบร้อยแล้วค่ะ
ขอบคุณค่ะ ^^
|
 |
 |
 |
 |
Date :
2012-02-17 23:51:24 |
By :
yim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|