jeshrian Posted September 20, 2010 Share Posted September 20, 2010 create_ckeditor.php <?php session_start(); date_default_timezone_set('Asia/Manila'); if($_SESSION['login']['Ad_UserName']==""||$_SESSION['login']['Ad_ExWrite']=="0"){ @header("Location:error.php"); }elseif($_SESSION['login']['Ad_ExWrite']!="1"){ echo "<script type='text/javascript'>alert('You don\'t have rights to access this panel. Please contact the Global Administrator!')</script>"; echo '<script type="text/javascript">history.go(-1)</script>'; } ?> <?php if($_SESSION['login']['Ad_ExWrite']=="1"){include("create_ckeditor_script.php");}; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" id="minwidth" > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>SRG Online Nursing Review</title> <script language="JavaScript" src="calendar_us.js"></script> <link rel="stylesheet" href="calendar.css"> <script type="text/javascript" src="js/calendar/calendar.js"></script> <link href="css/images/boss.ico" rel="shortcut icon" type="image/x-icon" /> <script type="text/javascript" src="js/tools.js"></script> <script type="text/javascript" src="js/validate.js"></script> <script type="text/javascript" src="js/deleteall.js"></script> <script type="text/javascript" src="js/clock.js"></script> <script type="text/javascript" src="js/popup/popup.js"></script> <link rel="stylesheet" type="text/css" href="css/main_import.css" /> <script type="text/javascript" src="js/menu.js"></script> </head> <body id="minwidth-body" onLoad="goforit()"> <?php include("includes/menu.html");?> <?php @include_once("class/class.php"); @$db=new DB(); @$db->connect(); $sql="SELECT * FROM tbl_coursecategory WHERE Course_IsAvailable=1 ORDER BY Course_Name ASC "; @$array=$db->get_as_array($sql); ?> <!--- menubar border STARTS ---> <div class="clr"></div> </div> <div id="content-box"> <div class="border"> <div class="padding"> <div id="toolbar-box"> <div class="t"> <div class="t"> <div class="t"></div> </div> </div> <div class="m"> <!--- ********************* title bar menu ********************* ---> <div class="toolbar" id="toolbar"> </div> <div class="header addexaminee48">Create Lecture</div> <div class="clr"></div> </div> <div class="b"> <div class="b"> <div class="b"></div> </div> </div> </div> <noscript></noscript> <div class="clr"> </div> </div> </div> </div> <div id="border"><div><div></div></div></div> <!--- Error Message---> <div class="m" style="margin-bottom:-10px;"> <?php if ($sw==1){ echo "<div class='errorMessage'><div class='error32'></div>"; echo "<div class='errorTxt'>"; echo "$msg</div></div><br />"; $sw=0; } ?> </div> <!--- End Error Message---> <!--- Menu Border Ends! ---> <!--- main Border STARTS ---> <div class="clr"></div> </div> <div id="content-box"> <div class="border"> <div class="padding"> <div id="toolbar-box"> <div class="t"> <div class="t"> <div class="t"></div> </div> </div> <div class="m" style="padding-left:20px; padding-right:20px;" > <br /><div style="font-size:12px"><b>Title of Lecture</b></div> <hr/><br /> <?php echo implode(file("http://localhost/SRG_MAIN/admin/ckeditor/_samples/srg.html")); ?> <?php include ("includes/menu_footer.html");?> </div> <div class="clr"></div> </div> <div class="b"> <div class="b"> <div class="b"></div> </div> </div> </div> <noscript></noscript> <div class="clr"> </div> </div> </div> </div> <div id="border-bottom"><div><div></div></div></div> <!--- main Border ENDS ---> <?php include("includes/footer.html");?> </body> <!--java script prompting sucessfully added!--> <?php if($_GET['popup']==1){ echo "<script type='text/javascript'>window.location='create_examinee.php';alert('Examinee Sucessfully Added!');</script>"; } ?> </html> create_ckeditor_script.php <?php @session_start(); @include_once("class/class.php"); @$db=new DB(); @$db->connect(); $sql="INSERT INTO tbl_lecture( orno, lecture ) VALUES( '$_POST[ORNo]', '$_POST[lecture]' )"; @$db->add_account($sql); @$db->close(); ?> I really need to change may table in database can someone guide mo how to enable a chapter or category each time i will save a content if i will save a content, it will only output continuously i wanted to make it per chapter or per category what do i need to do from here Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 20, 2010 Share Posted September 20, 2010 I'm not going to go through and rewrite all of your code for you, if that is what you are needing. You should be able to do that yourself or you should be posting in the freelance forum. But, I will provide some guidance on a *possible* solution. I say possible because I really don't understand what your project is so I am basing my comments on a general solution. I am a little confused by the code above. The first code block is saving data to the table 'tbl_coursecategory', and the second is pulling data from a table called 'tbl_lecture', so I have no idea what the two scripts have to do with each other. Ok, assuming you want content associated with a chapter/category, if you simply need chapters/categories listed as numerical entities (i.e. 1, 2, 3,...) AND you won't need to reorder the chapters/categories, you could simply add a field to the content table to specify the chapter/category. You can then pull the content from the table using an ORDER BY on that field. However, if you need the chapters/categories to have descriptive names and/or you may need to reorder them, you could create another table (e.g. chapters). That table could have fields such as chpt_id, chpt_name and chpt_order. The ID would just be a unique, auto-increment field, the name is obvious, and the order field is to specify the order in which the chapters are displayed. Then in your content table you would add a new field for a foreign key to specify the chapter ID. Then when you pull the records you would do a JOIN from the content table to the chapter table so you can order the content records by the chapter. Rough example: SELECT *FROM content_tableJOIN chapters ON content_table.chpt_id = chapters.chpt_idORDER BY chapters.chpt_order ASC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.