ขอถามวิธีเก็บค่าแบบ Array ลงฐานข้อมูล ว่าต้องทำยังไงค่ะ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ขอถามวิธีเก็บค่าแบบ Array ลงฐานข้อมูล ว่าต้องทำยังไงค่ะ
ขอถามวิธีเก็บค่าแบบ Array ลงฐานข้อมูล ว่าต้องทำยังไงค่ะ
Copy
สวัสดีค่ะ พอดีนู๋ได้ code นี้มาจากเว็บ http://www.jquerytips.com/
แล้วสงสัยว่าถ้าเกิดว่าจะเก็บนำข้อมูล $response นี้เก็บต่อในฐานข้อมูลต้องทำอย่างไรค่ะ
ข้อมูลที่ว่า มันอยู่ในรูปแบบของ array ค่ะ ต้องทำยังไงค่ะ
ช่วยด้วยนะค่ะ
ขอบคุณค่ะ
<?php require('facebook.php'); $facebook = new Facebook(array( 'appId' => 'YOUR_FACEBBOK_APP_ID', 'secret' => 'YOUR_FACeBOOK_APP_SECRET', 'cookie' => true, )); $action = (isset($_GET['action'])) ? $_GET['action'] : false; if ($action == 'save') { $signed_request = $_POST['signed_request']; $response = $facebook->parseSignedRequest($signed_request); echo "<pre>" . print_r($response, true) . "</pre>" . "n"; exit(0); } $custom_fields = array( array('name' => 'name'), array('name' => 'email'), array('name' => 'location'), array('name' => 'gender'), array('name' => 'birthday'), array('name' => 'password', 'view' => 'not_prefilled'), array( 'name' => 'like', 'description' => 'Do yout like this plugin?', 'type' => 'checkbox', 'default' => 'checked' ), array( 'name' => 'phone', 'description' => 'Phone Number', 'type' => 'text' ), array( 'name' => 'anniversary', 'description' => 'Anniversary', 'type' => 'date' ), array( 'name' => 'captain', 'description' => 'Best Captain', 'type' => 'select', 'options' => array( 'P' => 'Jean-Luc Picard', 'K' => 'James T. Kirk' ) ), array( 'name' => 'force', 'description' => 'Which side?', 'type' => 'select', 'options' => array( 'jedi' => 'Jedi', 'sith' => 'Sith' ), 'default' => 'sith' ), array( 'name' => 'live', 'description' => 'Best Place to Live', 'type' => 'typeahead', 'categories' => array('city', 'country', 'state_province') ), array('name' => 'captcha') ); $custom_fields_json = json_encode($custom_fields); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title>Facebook Registration Tool</title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <style type="text/css"> body { font-family: 'Lucida Grande', Verdana, Arial, sans-serif; } </style> </head> <body> <fb:registration fields='<?php echo $custom_fields_json; ?>' redirect-uri="http://www.osdev.com/APIs/facebook/facebook-tools/registration.php?action=save" width="530"> </fb:registration> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script type="text/javascript" > FB.init({ appId : '<?php echo $facebook->getAppId(); ?>', status : true, cookie : true, xfbml : true }); </script> </body> </html>

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ