Jump to content

dadamssg

Members
  • Posts

    729
  • Joined

  • Last visited

    Never

Everything posted by dadamssg

  1. I have a forum with a db table for Topics and one for the Responses. I'm trying to figure out the most efficient way to, like this forum, "Show new replies to your posts." right now i have a query that pulls up all topics that one has replied to...but i just realized that i will have an ever growing list because you have to be the last person to reply for it to not show up. What i want to do is exactly like this forum. It will show you the new replies to your posts but once you view the thread it doesn't show up on the list again. how should i go about organizing this? i'm thinking im going to have to have a new db table
  2. well i've got this now, but i can't get the second script to change it back to Delete Post <html> <body> <span><b>Delete Post</b></span> <script type="text/javascript"> document.getElementsByTagName("span")[0].onclick=function(){ document.getElementsByTagName("span")[0].innerHTML="<b><a href='#'>Delete</a> || <a href='#' id='del'>Cancel</a></b>" } </script> <script type="text/javascript"> document.getElementById('del').onclick=function(){ document.getElementsByTagName("span")[0].innerHTML="<b>Delete Post</b>" } </script> </body> </html>
  3. i think i have a little bit of it figure out below <html> <body> <p><b>Delete Post</b></p> <script type="text/javascript"> window.onclick=function(){ document.getElementsByTagName("p")[0].innerHTML="<b><a href='#'>Delete</a> || Cancel</b>" } </script> </body> </html> but how would i write that part that when cancel is pushed it goes back to default
  4. I have a forum and i want to give the users the ability to delete their posts if they have a typo or whatever. But i want to ask them if they are sure. How would i go about writing some javascript that would default say "Delete Your Post?" and then onclick change to "<a href='deleteresponse.php?id=23'>Yes</a> or No. And if they click No it will change back to "Delete Your Post?". i think this is fairly simple but just don't know how to do it
  5. what do you mean MySQL doesn't load all content into memory? and what is Sphinx? i developed a simple forum with two tables, Topics and Responses. For the sake of discussion, if my forum EVER got to be as used as phpfreaks would i have to worry about having TOO much in my database?
  6. nevermind....forgot i had the last_time field...i'm stupid
  7. really? nothing gets purged? phpfreaks.com isn't worried about having a crap load of memory taken up? or am i giving the amount of data stored in these forums too much clout?
  8. new question...same tables and what not how would i write a query for the main forum board that would pull up all topics and arrange them by activity. I.e. the topic that has the most recent responses gets listed first? any clue???
  9. i found this snippet to insert text into a text box where the caret is currently textBox1.Text = textBox1.Text.Insert(textBox1.SelectionStart, "Test"); but i don't know where to put this to make it work? is it part of a javascript function? do i put part of it equal to an onclick event?
  10. i've developed a forum and have a topics table and a responses table. I'm wondering how forums go about deleting the old topics and their responses? whats a good time length for the topic to be inactive before deleting?
  11. SOLVED...thanks again kickstart! SELECT * FROM Topics WHERE topic_id IN (SELECT DISTINCT a.topic_id FROM Responses a INNER JOIN ( SELECT topic_id, MAX(create_date) AS maxCreateDate FROM Responses WHERE created_by = '$userr' GROUP BY topic_id ) b ON a.topic_id = b.topic_id AND a.create_date > b.maxCreateDate)
  12. wow...that was impressive. It's almost what i want. This pulls up all the responses after a certain user's response. What i want is it to select the Topics. So....this pulls up the correct topic_id numbers...but i want it to pull these out of the Topic table so i can have all the info in the Topic rows. Does that make sence?
  13. Ok....deep breath....I have two tables. One for forum topics with the structure title varchar(100) created_by varchar(20) create_date datetime topic_id int(11) content text views int(11) replies int(11) last_user varchar(20) last_time datetime and one that holds the responses to those topics created_by varchar(20) create_date datetime topic_id int(11) response_id int(11) content text what i want to do is create a query that pulls up the topics that you've responded to BUT someone else posted a response since yours. Exactly like "Show new replies to your posts." link on this forum. any clues?
  14. so i have this function that works that adds the code tags but how do i re-arrange this to have the cursor in the middle of the tags???? <html> <head> <script language="Javascript"> function addsmile(smiley) { doc_content = document.myForm.myField.value + smiley document.myForm.myField.value = doc_content document.myForm.myField.focus() } </script> </head> <body> <form name='myForm' id='myForm'> <textarea name='myField' id='myField'></textarea> <a href='#' onclick="javascript:addsmile('[whatever][/whatever]')">Click</a> </form> </body> </html>
  15. i suck at javascript...can you show me how to work this? this is what i have...it's not doing anything though <html> <head> <script type="text/javascript"> function insertAtCursor(myField, myValue) { //IE support if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } //MOZILLA/NETSCAPE support else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } </script> </head> <body> <textarea name='myField' id='myField'></textarea> <button type='button'onlcick= insertAtCursor(document.formName.fieldName, 'this value'); >Click</button> </body> </html>
  16. hey sorry, i figured it out. thanks though $no = "UPDATE Topics SET last_time= '$today', last_user = '$username' WHERE topic_id = '$postid'";
  17. how do i write this query to work??? $no = "UPDATE Topics SET (last_time, last_user) VALUES ('{$today}','{$username}')";
  18. how would i go about coding a javascript snippet where, like this forum, you can click a smiley and then it outputs certain characters into the textarea?
  19. how do i make this, which works $regex = "#([\[]b[\]])(.*)([\[/]/b[\]])#e"; $output = preg_replace($regex, "('<b>$2</b>')", $reply); into a function like this?...which doesn't work function forumtags($text) { $find = array ( '#([\[]b[\]])(.*)([\[/]/b[\]])#e', ); $replace = array ( '<b>$2</b>', ); return preg_replace($find, $replace, $text); } i get this error Parse error: syntax error, unexpected '<' in /home/inaggie1/public_html/main/showthreadf.php(23) : regexp code on line 1 Fatal error: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Failed evaluating code: <b> bold</b> in /home/inaggie1/public_html/main/showthreadf.php on line 23
  20. nevermind..figured it out! $regex = "#([\[]b[\]])(.*)([\[/]/b[\]])#e";
  21. this is a pattern that matches "{b}whatever{/b}" $regex = "#([{]b[}])(.*)([{]/b[}])#e"; how do i replace the {'s with brackets? trying to write some bulletin board code so i want it to match "[ b ]whatever[ /b ]"...except without the spaces
  22. i get this when i tried that snippet Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 15 in showthread.php on line 30
  23. I want do exactly what this forum does...as in you can write [ code ] whatever [ / code] and it will replace that with other tags wrapped around "whatever". How do i write a function to do this? i really want to have an image tag. So it would be something like [ img ]url-to-the-image[ /img ]. (Of course i don't want the spaces in the tags...not sure how this forum with interpret it) Then when you write those tags it would replace it with html image tags. how the heck would i write this function? help would be GREATLY appreciated
  24. would it be easier to have fields in my Topics table that are Last_Post...that would contain the user who last posted on that topic and when OR to write a crazy query that would pull this up for me. I have a seperate table for the Replies. was thinking whenever someone submitted a replie i could just update that Last_Post field in the Topics table with that info...but then if i had to delete that reply for whatever reason the Last_Post wouldn't be accurate. on the other hand, i could beg you guys to help me write a query that would A. pull up all topics and their info B. WHILE, pulling up the last post info from the replies table thoughts?
×
×
  • 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.