setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $result = $conn->prepare($sql); try { $result->execute(); $rows = $result->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { echo "Error : " . $e->getMessage(); } //นับจำนวนเข้าชม $view = $rows['view'] + 1; $sql = "update guide set view='$view' where id ='$_GET[n]' "; $result = $conn->prepare($sql); $result->execute($_GET); //กำหนดตัวแปล $id = $rows['id']; $title = $rows['title']; $view = $rows['view']; $createDate = $rows['createDate']; $detail = $rows['detail']; $contentTypeID = $rows['contentTypeID']; $coverImg = $rows['coverImg']; $subTitle = $rows['subTitle']; $tag1 = $rows['Tags1']; $tag2 = $rows['Tags2']; $tag3 = $rows['Tags3']; $tag4 = $rows['Tags4']; // สร้างอาร์เรย์และเก็บค่าTags $tagsArray = array(); // ประกาศอาร์เรย์เปล่า $tagsArray[] = $tag1; // เพิ่ม tag1 $tagsArray[] = $tag2; // เพิ่ม tag2 $tagsArray[] = $tag3; // เพิ่ม tag3 $tagsArray[] = $tag4; // เพิ่ม tag4 //ดึงข้อมูลประเภท $sql = " SELECT title FROM guidaType where id ='$rows[guidaTypeID]' "; $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $result = $conn->prepare($sql); try { $result->execute(); $rows = $result->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { echo "Error : " . $e->getMessage(); } ?>