Jump to content

arunpatal

Members
  • Posts

    273
  • Joined

  • Last visited

Everything posted by arunpatal

  1. Yes, you are right
  2. arunpatal

    FULL JOIN

    Hi, I have 2 tables category (cat_id, cat_name) AND subcategory(sub_cat_id, sub_cat_name, category_id) I am tring to run a simple full join statement. <?php require("connect/connection.php"); $sql = mysql_query(" SELECT * FROM $category FULL JOIN $subcategory ON $category.cat_id = $subcategory.category_id ") or die(mysql_error()); ?> And i get a error Unknown column 'category.cat_id' in 'on clause'
  3. Yes i want to execute some code..... for example... first i submit some php code via this rich text editor to mysql database, then i execute this code on page.
  4. Is there any form textarea editor in which i can also execute php code?????
  5. <script> function iFrameOn(){ richTextField.document.designMode = 'On'; } function iBold(){ richTextField.document.execCommand('bold',false,null); } function iUnderline(){ richTextField.document.execCommand('underline',false,null); } function submit_form(){ var theForm = document.getElementById("myform"); theForm.elements["myTextArea"].value = window.frames['richTextField'].document.body.innerHTML; theForm.submit(); } function createDiv() { var divTag = document.createElement('div',false,null); divTag.id = "div1"; divTag.style.border = "1px solid #333"; divTag.className = "dynamicDiv"; divTag.innerHTML = "This HTML Div tag created " + "using Javascript DOM dynamically."; window.frames['richTextField'].document.body.appendChild(divTag); } </script> <body onLoad="iFrameOn();"> <table><td width="100%" valign="top"> <h2>My web application that intakes data from users</h2> <form action="richtext.php" name="myform" id="myform" method="post"> <div id="wysiwyg_cp" style="padding:8px; width:700px;"> <input type="button" onClick="iBold()" value="B"> <input type="button" onClick="iUnderline()" value="U"> <input id="btn1" type="button" value="create div" onClick="createDiv();" /> </div> <textarea style="display:none;" name="myTextArea" id="myTextArea" cols="100" rows="14"> </textarea> <iframe name="richTextField" id="richTextField" value="11" style="border:#000000 1px solid; width:700px; height:300px;"> </iframe> <br /><br /><input name="myBtn" type="button" value="Submit Data" onClick="javascript:submit_form();"/> </form> </td> </table> I want that when javascript ['richTextField'] pass value to ["myTextArea"].... It dosent change < and > to < and >...... can i make a array where i write words & these word will exchange with another word (or another array) and then ['richTextField'] pass value to ["myTextArea"]. with array i mean somthing like this replace('<', '<').replace('>', '>')
  6. First of all thanks that you came back and helped....... Next time i will make sure that i can provide maximum and clear information. Now the good thing This works...... now showing exactly the way i want... Many thanks to Barand & Jazzman1
  7. $datatb is a topic table.... id int auto_increment primary key, topic_title mediumtext, topic_detail mediumtext, added_date date, sub_id int(11) This is where sub_cat_id from subcategory table is saved and my subcategory table is like this sub_cat_id int auto_increment primary key, sub_cat_name varchar(500), category_id int(11)
  8. What should i use instead of CONCATE_GROUP()?
  9. Sorry about that........ I could not explain nicely at the beginning
  10. This is the result Subcategory 1 Array ( [name] => topic1, topic2, topic3, topic4 [id] => 6 ) Subcategory 2 Array ( [name] => topic1, topic2, topic3, topic4 [id] => 8 )
  11. Ok......... Its working "SELECT s.sub_cat_name, s.sub_cat_id, t.topic_title, t.id , GROUP_CONCAT(t.topic_title ORDER BY t.id DESC SEPARATOR ', ') as topic_title FROM $subcategory s INNER JOIN $datatb t ON(s.sub_cat_id=t.sub_id) GROUP BY s.sub_cat_id ORDER BY s.sub_cat_id DESC LIMIT 5;" But new problem is that all topics are showing as one link........ Something like this Item1,Item2,Item3 i am sure it have to do with loop.... This is the new code to echo .. while($row = mysql_fetch_assoc($result)){ $categories[$row['sub_cat_id']]['subcat'] = array('name' => $row['sub_cat_name']); $categories[$row['sub_cat_id']]['topics'][$row['id']] = array('name' => $row['topic_title'], 'id' => $row['id']); } foreach($categories as $sub_cat_id => $row): echo "<div id='subcat_list'>".strtoupper($row['subcat']['name'])."</div>"; foreach($row['topics'] as $sub_id => $sub_row): echo "<div class='topic_list' id='topic_list$sub_row[id]'> <a href='review.php?topic_id=$sub_row[id]&datatb=$datatb'>"; echo strtoupper($sub_row['name']); echo "</a></div>"; endforeach; echo "<br>"; endforeach; }};
  12. No, and i have no idea how to do this.....?????????
  13. This is how my topic table look like...... Table name PHP id int auto_increment primary key, topic_title mediumtext, topic_detail mediumtext, added_date date, sub_id int(11) This is sub_cat_id from subcategory table And this is my subcategory table look like sub_cat_id int auto_increment primary key, sub_cat_name varchar(500), category_id int(11)
  14. I think it is because of loop....... Check this code...... $categories = array(); $result = mysql_query("SELECT * , GROUP_CONCAT(t.topic_title ORDER BY t.id DESC SEPARATOR ', ') as items FROM $subcategory s INNER JOIN $datatb t ON(s.sub_cat_id=t.sub_id) GROUP BY s.sub_cat_id ORDER BY s.sub_cat_id DESC LIMIT 5;"); while($row = mysql_fetch_assoc($result)){ $categories[$row['sub_cat_id']]['subcat'] = array('name' => $row['sub_cat_name']); $categories[$row['sub_cat_id']]['topics'][$row['id']] = array('name' => $row['topic_title'], 'id' => $row['id']); } foreach($categories as $sub_cat_id => $row): echo "<div id='subcat_list'>".strtoupper($row['subcat']['name'])."</div>"; foreach($row['topics'] as $sub_id => $sub_row): echo "<div class='topic_list' id='topic_list$sub_row[id]'> <a href='review.php?topic_id=$sub_row[id]&datatb=$datatb'>"; echo strtoupper($sub_row['name']); echo "</a></div>"; endforeach; echo "<br>"; endforeach; }};
  15. Same result
  16. Its working like subcat 1 item1 subcat 2 item1 subcat 3 item1 and so...... Subcategory have more item in it...............
  17. It gives error like this Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\my_site\functions.php on line 28
  18. Is there is a way that javascript rich textarea doesn't escape < and > ????
  19. thanks
  20. Hi, If i have some code to display then i will do like this. <?php highlight_string('<?php echo"Hello World"; ?>') ?> But what if the code is big and content many ' For example <?php highlight_string('<?php echo'Hello World' "Hello World" 'Hello World' "Hello World"; ?>') ?> Is there a function which can auto add \ front of ' which is in highlight_string???
  21. I need 5 rows of subcategroy.... The code above brings 5 row of subcategorys but it shows only 1 item in each subcategory.. Like this Subcat1. itrem1 subcat2 item2 subcat3 item3..... and so on..... I want it to be like this subcat 1 item1, item2, item3 subcat 2 item1, item2 subcat 3 item1, item2, itme3, item4 subcat 4 item1, item2 subcat 5 item1, item2, itme3, item4, item5
  22. lets say i hav 6 subcategory and each subcategory have 10 entrys from datatb table... I want to limit subcategory to 5 but then problem is that its showing only one subcategory with 5 entrys. I want to display 5 rows of subcategory
  23. $result = mysql_query("SELECT s.sub_cat_id, s.category_id, s.sub_cat_name, t.id, t.topic_title FROM subcategory s INNER JOIN datatb t ON(s.sub_cat_id=t.sub_id) ORDER BY s.sub_cat_id $DESC_ASC, t.id $DESC_ASC LIMIT 5"); The number of limit should be from subcategory table but its geting limit of datatb..... ????????
  24. everything is working just fine the way i did.......... but the only problem is that the message DATA INSERTED dose not show inside the div...... Its showing DATA INSERTED message above the div (div which is in function a) OK.... Its working now........ function b should return the value but not echo...... function b() { insert into database statement..... return "data inserted"; Thanks Barand
  25. can i execute function within a function ??? For example function a ($form) { echo "<div> $form </div>"; } function b() { insert into database statement..... echo "data inserted"; } if (isset $_POST["name"]) { a ( b() ) } else { a (<input type="text" name="name">) }
×
×
  • 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.