Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by breaststroke

  1. I've found a solution, at least it has worked once. I had and have to do this: if($reg=mysql_fetch_array($registros2))since it belongs to $registros2. I hope it keeps working... birbal, thank you very much for replying, I hadn't seen your last message till after submitting mine. It seems I found the solution. I guess the While loop got stopped when it came across that wrong $registros.I'll check the links you provide. I didn't know about thoem and I am sure they'll come in handy.thank you very much again! p.s I have to do that when I do a query through $registros2, before the Update
  2. Hello! Thank you for replying.It doesn't return any errors. But only one e-mail is sent and the last query to the database doesn´t work either (there is no such UPDATE).
  3. Hello, I have a problem involving Phpmailer and a While loop. Actually I have always had problems to sending emails this way. Now for instance I can send e-mails trough an IF (instead of While) and the following script works fine. But as soon as I change it into While it doesn't. Even the last part of the script (UPDATE) doesn't work (it worked upon IF). I am trying with just two e-mails to be sent and only the first one is sent.I would be so happy to solve this issue. While loop is really important when it comes to sending e-mails. This is my script: ...include('conexioninclude.php');mysql_set_charset('utf8');$registros=mysql_query("SELECT mail, name, password, codigo FROM alert WHERE status='on' AND language1='$language2' AND language2='$language1' AND way LIKE '%$way%' ORDER BY codigo",$conexion)ordie("Problems at selectt:".mysql_error());require("class.phpmailer.php");$mail = new PHPMailer();while($reg=mysql_fetch_array($registros)){$mailu=$reg['mail'];$namee=$reg['name'];$password=$reg['password'];$codigo=$reg['codigo'];$mail->IsSMTP();$mail->Port = 465;$mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true;$mail->Username = "xxxxx";$mail->Password = "xxxxxx"; // SMTP password$webmaster_email = "xxxxxx"; //Reply to this email ID$email="xxxxx"; // Recipients email ID$name="Admin"; // Recipient's name$mail->From = "xxxxxx";$mail->FromName = "Sharinglanguage.com";$mail->AddAddress($mailu,$namee);$mail->AddReplyTo(xxxxxx,"Webmaster");$mail->WordWrap = 50; // set word wrap$mail->SetLanguage("en","/php/language/");$mail->AddAttachment("/var/tmp/file.tar.gz");$mail->AddAttachment("/tmp/image.jpg", "phone.jpg");$mail->AddAttachment("image.jpg", "phone.jpg"); $mail->IsHTML(true); // send as HTML$mail->Subject = "xxxxxxxxx";$foto= "imagess/bonito.jpg";$mensaje='<font-color="#559999"><img src="'. $foto .'" width="600"><br /><br />Hello '.$namee.',<br /><br />xxxxxxxxxxxxxxxx .<br /><br />Sincerely yours</font>'; $mail->MsgHTML($mensaje);if(!$mail->Send()){print<<<HEREmessage wasn't sent;HERE;}else{$registros2=mysql_query("SELECT yep FROM vamos WHERE password='$password'",$conexion)ordie("Problems at selectt:".mysql_error());if($reg=mysql_fetch_array($registros)){$yep=$reg['yep']; // it's an Int type field (numbers)$saw=$yep+1;$registros3=mysql_query("UPDATE vamosSET yep='$saw'WHERE password='$password'",$conexion)ordie("Proble8uhims with selectttt:".mysql_error());}print<<<HEREsuccess!;HERE;}... Thank you very much in advance for any help. Regards
  4. Hi,I got it. The compareTo method is not for arranging Strings by their number of characteres but by their alphabetical order. Sorry!
  5. I don't know if it's necessary to say, but i am working on Java.I have realised the compareTo method works but only with Strings which start with the same letter. Then it arranges them properly.But it only arranges from lowest to higuest the String that start with the same letter.Isn't there a method which can be applied to any Strings regardless the letter they start with? p.s when above I say "order", I meant "arrange", "sort". English not being my native language..., sorry.
  6. Hello, I am trying to comprehend how to compare the length between Strings.i have the following, to compare the length of 10 countries inserted by the user. It also orders them from lowest to highest: public void load() { teclado=new Scanner(System.in); paises=new String[10]; for(int f=0;f<paises.length;f++) { System.out.print("Ingrese el nombre del pais:"); paises[f]=teclado.next(); } } public void ordenar() { for(int k=0;k<9;k++) { for(int f=0;f<9-k;f++) { if (paises[f].compareTo(paises[f+1])>0) { String aux; aux=paises[f]; paises[f]=paises[f+1]; paises[f+1]=aux; } } } } When I use the same method with numbers it works. For instance: public void ordenar() { for(int k=0;k<9;k++){ for(int f=0;f<9-k;f++) { if (vec[f+1]<vec[f]) { int aux; aux=vec[f]; vec[f]=vec[f+1]; vec[f+1]=aux; } } } } So I deduce maybe : if (paises[f].compareTo(paises[f+1])>0) is not correct, because it's the only difference comparing it to the method on numbers.Is there any other way to compare the length between Strings? thank you in advance. p.s I took it from a tutorial which has been working fine till now. I have even checked the "compareTo" on other sites and it seems to be appropriate but I don't know why it's not working here. I would appreciate any help.
  7. I have managed to solve it.I don't completely figure it out and since it is a very particular problem probably it's not neessary to explain (or try to.) what i have done.But if someone wants me to try I am ready and set. Regards
  8. Hello. I have created an animation which consists of several movie clips.I have added an stop at the end of the main Time Line so that everything gets stopped. But when managing one of this movie clips ('mywindow'), I don't know what I have done (I have gotten it to stop and to play later on) that now it disappears in the last frame, and it shouldn't.I don't know how to correct this and why this happened.I would appreciate any help.This is the link of the file: https://hotfile.com/...facade.fla.html Thank you vey much,Regards
  9. Thank you very much birbal.I don't know anything about annonymouse functions yet, I will check it out.I conclude I can request two pages within the same function as I showed above. I will try.Regards
  10. Hello! I am wondering whether we can make to calls to different pages within the same function.Something like this: function lcalls(){var xmlhttp;if(window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.open("GET","calls1.php",true);xmlhttp.send();xmlhttp.open("GET","calls2.php",true);xmlhttp.send();//maybe it would be enough to type just one send() at the bottom?} Or, if we could have two different functions within the same event.Something like this: <body onkeyDown="calls1(),calls2()"> I can try them, but I don't know whether to do that is correct or not.Thank you in advance.
  11. hi, Finally, i got it to work fine (at least for now;)), thanks to this link: http://snipplr.com/view/5144/getset-cursor-in-html-textarea/
  12. Hello, I just wanted to say I thank you for the courses you offer through w3school. I have learnt a lot from them.thank you, also, for these forums. Regards.
  13. Hello, I am trying to replace an emoticon for text into a textarea (Actually I may be interested in including the emoticon itself, but it seems to be more complex, and first I would like to learn how to do this.)I have the following in HTML: <a href="javascript:Smile(' [] ')"><img src="http://www.websmileys.com/sm/sad/239.gif" border="0" alt="imagen" /></a><br /><div style="text-align:center;margin-bottom:25px"><form name="formulariol"><textarea cols="40" name="textol"rows="4" id="txt" ></textarea></form> and the following, in Javascript, related to the former: <script type="text/javascript">function Smile(texto){document.formulariol.textol.value = document.formulariol.textol.value + texto;document.formulariol.textol.focus();}</script> It works fine, but either in Chrome or in Safari the cursor is set just before the text that replaces the emoticon, not after.I would like it to be at the end of the text, in all browsers.any idea about how to handle this, please? Thank you very much in advance. Regards
  14. Hello thescientist. Thank you for your response and your explanations too. I have found another code which includes the e into de function.yours didn't work but i will try to analyze it so that I work it out.this is what I have made: function showUser(str,e){var keycode=e.which?e.which:e.keyCode;if (keycode == 13){if(str==""){... Thanks a million
  15. Hello Ingolme. Thank you.This is the HTML code related to the function: <textarea cols="20" name="texto"rows="4" id="txt" onkeyPress="showUser(this.value)"></textarea></div> the function works untill that part, but on Firefox.On the rest of browsers it works fine.According to my information keydown would seem more appropriate but i have tried with it as well and I have found the same problem.I have read somewhere onkeyPress and the code I have inside the function are a good option. Regards p.s.I have edited the javascript function on the previous post because I had duplicated the same code.As you suggest, if I include an alert (for example) just when the function starts it is okay, but not when I do it after: if (keycode == 13){Thank you again.
  16. Hello again! I am having a problem on firefox.I have an event (onkeyPress) on a textarea, which should trigger a function when the key pressed is Intro.I would have the following on HTML: HTML Code:..<textarea id="idtextarea" onkeyPress="showUser(this.value)"></textarea>... In javascript: ...function showUser(str){var keycode;if(window.event) keycode = window.event.keyCode;else if (e) keycode = e.which;else return true;if (keycode == 13){var xmlhttp;if(str=="") {.... It works on the main browsers but not on Firefox. Nothing happens on this browser. I would appreciate any help.Thank you very much.Regards
  17. dsonesuk, thank you too.I managed to make it work. I was my fault because i had left some variables where they shouldn't be.I am going to try to adapt your code to mine, creating an array. Regards
  18. It works!!!! Thank you so much! It was my fault, once again...As I had been trying several different ways i had left some variables where they shouldn't be. once removed it works fine.It is even amazing to see an image on the div:).Now I have to create an array because it is more than one image that I want to add.I will check dsonesuk's post, which seems to be very useful. thank you
  19. It doesn't give me anything back (not even other characteres), as if there were some error. I don't know why. The image is found on another part of the page. I don't know what I can do.
  20. Hi again. thank you very much.I have tried both ways but it doesn't work.This is what I have tried: xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4 && xmlhttp.status==200) { newdiv.innerHTML = "<span style='color: #661166;'>"+name+"</span>:"+" "+xmlhttp.responseText.replace(/t/gi,"<img src=\"public_html/imagess/cornerbif.jpg\" alt=\"Smiley face\" width=\"10\" height=\"10\"/>"); } }var add; and: xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4 && xmlhttp.status==200) { newdiv.innerHTML = "<span style='color: #661166;'>"+name+"</span>:"+" "+xmlhttp.responseText.replace(/t/gi,'<img src="public_html/imagess/cornerbif.jpg\' alt="Smiley face" width="10" height="10" />'); } }var add;.. I think I did as you suggested. The image root is okay because I have it on another part of the page. I an not planning to replace any "t" with an image, but it is just to test it. I would replace other texts. by the way, I suppose I will have to create an array becuase I wil try to replace several strings. could I create an array on the replace function? thank you very much again Regards p.s. Thank you dsonesuk. I hadn't seen your post before I submitted mine. i will study your code.Thank you so much
  21. Hello again, Thank you very much. I wasn't considering an image as string.My fault.I have tried with text and it works fine, but when I include an image tag it doesn't.This is the function: ..xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4 && xmlhttp.status==200) {//I use the replace function here. If I replace the string with text it works, but it doesn't this way(with an image): newdiv.innerHTML = "<span style='color: #661166;'>"+name+"</span>:"+" "+xmlhttp.responseText.replace(/t/gi,"<img src="public_html/imagess/corner.jpg" alt="Smiley face" height="42" width="42" />"); } }//to add a new element inside a div I already have:var add;var add=document.createElement("div");var newdiv=add;//in order for the new elements to appear one after another (appendChild):var container;var container = document.getElementById("chata");container.appendChild(newdiv);xmlhttp.open("GET","chatterb.php",true);xmlhttp.send();}.. Thank you very much.
  22. Thank you justsomeguy.I had already tried that function, but it may be just for strings. When I add the image url into it as the "substring" to be replaced, it doesn't work.i think I may need a different function or maybe the same one, but how would I place the image? this is the function you are talking about: var str="Visit Microsoft!";document.write(str.replace("Microsoft", "W3Schools")); Besides, I think the "write" part is suggesting we work with strings not with images. Not sure about it, though.I have tried getting the url into it , but it doesn't work. Thank you
  23. Hello!!! I am working on a chat developed with Ajax.I am trying to add emoticons to a chat on my site.I am planning to transfom them into text before sending them to the database. This is okay and i know how to do it.The problem is when I want to display those emoticons (along with text) on a div, after querying the data base.I don't know how to transform the text into images.I guess I have to use the Replace function or a similar one, but i don't know how to do it with images. this is what I have, the function which send the data to another page and get the response.I am using appendChild because I want the new texts to be placed after the previous ones. ....//the image/s I want to display:var imagen=new Imagen();imagen.src="http://www.websmileys.com/sm/sad/239.gif";....xmlhttp.onreadystatechange=function() {if(xmlhttp.readyState==4 && xmlhttp.status==200) {/* get here the response after having visited the page chatter.php*/ newdiv.innerHTML =xmlhttp.responseText; } }//I create a new element to put the new data:var add=document.createElement("div");var newdiv = add;//the element I already have on HTML:var container = document.getElementById("iddiv");container.appendChild(newdiv);xmlhttp.open("GET","chatter.php",true);xmlhttp.send();.......} Let's suppose I have some text like: uwyeruw--qweoo00, that I want to transform into the image above.How can i do that and send it along the rest of the text, into the newdiv variable? Thank you very much in advance, for any hint and for reading my post. Regards
  24. hello,thank you justsomeguy again,I may start to consider the server a new variable, somehow, hehe, as if we worked with few:PThank you all. I couldn't expect more help on this issue.Best regards.
  25. Hi birbal,thank you for your comment and explanation.I think I more or less understood that . That using the first function to unescape those characters I have to "escape" them again to insert them in my database.But what is strange (for me) is the fact that I didn't need to unescape those characters untill now. The link that you have provided me and that I was also checking a little yesterday says it has been recently updated.So maybe magic quotes have been very recently declared deprecated and that's why not until now I have needed to "escape" those characters.Regards, and thank you so much again.
  • Create New...