Jump to content

tehjagjr

New Members
  • Posts

    3
  • Joined

  • Last visited

tehjagjr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. id go with <?php $count = 0; ?> <table> <tr class="parent" id="row<?++count;?>" title="click to expand"> <td>Name to be clicked</td> <tr> <tr class="child-row<?++count;?>"> <td>More Info</td> </tr> or if you have a unique id in the DB use echo $id;
  2. If i read this right.. you want to add a unique ID for a html div? or you want to add a unique ID for a mysql row?
  3. Hi guys, ive got an awkward problem that doesn't seem to want to fix itself no matter how hard i try. Basically, I have in my Database a table called horses and the columns are I then have a php webpage with a dropdown box which is populated from the database. <form action="" method="post" align="center"> <fieldset> <select name="horses" onchange="benSucksDick(this.value)" align="center"> <option value="">Select a Horse</option><Br><br><br> <!-- RUN QUERY TO POPULATE DROP DOWN --> <?php mysql_connect("localhost", "root", "") or die("Connection Failed"); mysql_select_db("horse")or die("Connection Failed"); $query = "SELECT * FROM horses ORDER by ID"; $result = mysql_query($query) or die(mysql_error()); /*$num = mysql_num_rows($result);*/ while($row = mysql_fetch_array($result)) { echo "<option value='".$row['ID']."'>".$row['Name']."</option>"; } ?> </select></fieldset> I also have a AJAX call to edit.php which fetches the data in column web_horse and outputs it to a CKeditor instance. AJAX code <script type="text/javascript"> function benSucksDick(str) { if (str=="") { document.getElementById("maincontent").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("maincontent").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","content/edit.php?q="+str,true); xmlhttp.send(); } </script> edit.php Code <?php error_reporting(-1); // Make sure you are using a correct path here. include 'ckeditor/ckeditor.php'; $ckeditor = new CKEditor(); $ckeditor->basePath = '/ckeditor/'; $ckeditor->config['filebrowserBrowseUrl'] = '/ckfinder/ckfinder.html'; $ckeditor->config['filebrowserImageBrowseUrl'] = '/ckfinder/ckfinder.html?type=Images'; $ckeditor->config['filebrowserFlashBrowseUrl'] = '/ckfinder/ckfinder.html?type=Flash'; $ckeditor->config['filebrowserUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; $ckeditor->config['filebrowserImageUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; $ckeditor->config['filebrowserFlashUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'; mysql_connect("localhost", "root", "") or die("Connection Failed"); mysql_select_db("horse")or die("Connection Failed"); $q=$_GET["q"]; $sql="SELECT web_content FROM horses WHERE id = '".$q."'"; $resultab = mysql_query($sql); while($row = mysql_fetch_array($resultab)) { echo $row['web_content']; } ?> Now, the CKeditor initialises when the page is loaded, but when i change the dropdown to a different value from the database it just shows the html code and/or a text area WITHOUT the CKeditor instance. If anyone can help me, that would be grand!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.