Showing posts with label how to get data from ckeditor in php. Show all posts
Showing posts with label how to get data from ckeditor in php. Show all posts

Saturday 16 August 2014

how to retrieve data of ckeditor from database

In our last tutorial of how to get data of ckeditor ckeditor text input insert into database full source code
this is part one which explain how to store ckeditor's text into database.We are PHP and MYSQL.

cktext table file for database ckeditor This is for database 

 

 explanation of how to retrieve saved data of ckeditor from database

only change in add.php file

<?php
include("mysql.php");

if(isset($_POST["button2"]))
{
$sql="INSERT INTO cktext (papername,email,subject,section,description,upload,uploadtext)
VALUES
('$_POST[textfield]','$_POST[te]','$_POST[select]','$_POST[select2]',
'$_POST[textarea]','$_POST[fileField]','$_POST[editor1]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
  else
  {
echo "Question paper uploaded Successfully</br> YOUR TEXT IS";
$data = mysql_query("SELECT * FROM cktext") or die(mysql_error()); Print "<table border cellpadding=3>";

while($row = mysql_fetch_array( $data ))
 {
 Print "<tr>"; Print "<th>Name:</th> <td>".$row['papername'] . "</td> ";

 Print "<th>Blog:</th> <td>".$row['uploadtext'] . " </td></tr>";


echo "--------------------------------<br>";
echo "EMAIL ID :{$row['email']}  <br> ".
         "description : {$row['description']} <br> ".
         "upload : {$row['upload']} <br> ".
         "--------------------------------<br>";

 } // end of while
 
Print "</table>";
 
}//else

 }//first if isset


?>

-------------------------------------------THE END-----------------------------

 } // end of while
 
Print "</table>";   <<<<<< END OF TABLE AFTER WHILE CLOSING
  

 

You can print BLOG in new line

while($row = mysql_fetch_array( $data ))
 {
 Print "<tr>"; Print "<th>Name:</th> <td>".$row['papername'] . "</td></tr>";

Print "<tr>"; Print "<th>Blog:</th> <td>".$row['uploadtext'] . " </td></tr>";