  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                ตอนนี้กำลังพัฒนาออกมาเรื่อยๆเลยผมกำลังจะทำหน้าติดตั้ง CMS อ่ะครับแต่เวลาจะ Import ข้อมูลด้วยการเขียน PHP มัน Import ไม่ได้อ่ะครับ 
 
Code (SQL) 
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 04, 2017 at 05:35 PM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `mago`
--
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
  `ID` int(10) NOT NULL,
  `Name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Detail` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `Url` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Active` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
  `ID` int(10) NOT NULL,
  `KnowledgeID` int(10) NOT NULL,
  `Author` int(10) NOT NULL,
  `Detail` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `Date` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Active` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
  `ID` int(10) NOT NULL,
  `Title` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Detail` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `Description` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Keyword` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Bot` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Views` int(10) NOT NULL,
  `Comments` int(10) NOT NULL,
  `Date` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Cover_img` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Author` int(10) NOT NULL,
  `Active` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL,
  `Tags` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Categories` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `posts`
--
INSERT INTO `posts` (`ID`, `Title`, `Detail`, `Description`, `Keyword`, `Bot`, `Views`, `Comments`, `Date`, `Cover_img`, `Author`, `Active`, `Tags`, `Categories`) VALUES
(1, 'Hello\' World', 'สวัสดีนี่คือเว็บแรกของคุณ และนี่ก็คือบทความแรกของคุณด้วย ขอบคุณที่คุณได้ใช้งาน <strong>Mago CMS</strong> ของเรา', 'นี่คือคำอธิบาย', 'นี่คือคีย์เวิร์ด', 'นี่คือบอท', 0, 0, 'วันศุกร์ 2560', 'NO', 1, 'Y', 'Uncategories', 'Untags');
-- --------------------------------------------------------
--
-- Table structure for table `tags`
--
CREATE TABLE `tags` (
  `ID` int(10) NOT NULL,
  `Name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Detail` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `Url` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Active` enum('Y','N') COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
  `ID` int(10) NOT NULL,
  `Username` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Password` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Name` varchar(35) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Avatar` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Permission` enum('Control','Default') COLLATE utf8mb4_unicode_ci NOT NULL,
  `Address` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `Phone` int(10) NOT NULL,
  `Website` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Facebook` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Blogger` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Corporation` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Active` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
  ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
  ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `tags`
--
ALTER TABLE `tags`
  ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
  MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
  MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tags`
--
ALTER TABLE `tags`
  MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 
 
ตัว SQL ที่ได้หลังจาก Export ออกมาได้แบบนี้ครับ แล้วผมทำการเพิ่มคำหน้าหน้า Table เป็น {PREFIX}ตามด้วยชื่อ ในส่วนนี้มันก็ไม่ได้ Error อะไรครับ มันไป Error ตอนที่จะ Import เข้าไปครับ 
 
ปกติผมเขียนไว้แบบนี้ 
Code (PHP) 
<?php
   $sql = file_get_content('install/data.sql'); // ดึงข้อมูลของไฟล์ที่ Export ออกมา
   $sql = str_replace('{PREFIX}', $_SESSION["prefix"], $sql);
   $result = mysqli_query($link, $sql);
   if($result) { echo "<h1>เสร็จสิ้น</h1>"; }
   else { echo "<h1>ผิดพลาด</h1>"; }
  // ตัวอย่างจะประมาณนี้ครับ
?>
 
ผม Import เข้าไม่ได้ แต่เวลาไป Import ในหน้าเว็บ PHPMYADMIN มัน  Import ได้ครับ
 
 
  Tag : PHP, MySQL, HTML, CSS, HTML5, Ajax               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2017-08-04 20:58:03 | 
                      By :
                          Androidgamer | 
                      View :
                          1167 | 
                      Reply :
                          3 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  |