Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. assign it to a variable $conn1 = mysql_connect(...); $conn2 = mysql_connect(...);
  2. if (stripos($url,'yourdomain.com')) echo $url;
  3. if you plan on making that list of numbers grow, it would be better for you to do this: $memberIds = array('1','2'); if(in_array($member['id'],$memberIds)) { // stuff here } That way you can just add to the array the single id instead of having to have this really long condition. And you can dynamically populate the array. Can't dynamically populate the condition unless you get into using eval() (which you don't want to do).
  4. $string = "http://img.youtube.com/vi/XrL5YIsUQu0&hl=en&fs=1&rel=0/default.jpg"; preg_match('~/([^&/]*)&~',$string,$colonizer); $thumb_name = "http://img.youtube.com/vi/".$colonizer[1]."/default.jpg";
  5. $hp = ($hp < 0)? 0 : $hp; echo "...";
  6. use { } instead of [ ] when treating a string like an array
  7. remove average_note stuff from your php and put it in your query and then sort by it ... ( total_value / total_votes ) as average_note ... order by average_note
  8. $hp - $yourhit;
  9. where did the data come from, a db query? better to sort it in your query than with php. If not, look into array_multisort or also if I remember correct, there's a couple of user-made multi-dim array sorts in the user posted notes of sort
  10. you changed all of them?
  11. that's because && is the 'and' operator, meaning "this and this" and = is the assignment operator. http://us2.php.net/manual/en/language.operators.comparison.php
  12. trim only removes stuff on the beginning and end of a string, not stuff in-between. Though you did bring up a good point: It will remove all dots from the end, so if It's a regular sentence with a single dot, that will be removed...but considering (according to his before -> after examples) he seems to be fine with some results having no periods, if he can live will all results being without a period on the end, this would be ideal.
  13. Maybe it's because you are missing an operator in there?
  14. Okay so you are saying that sometimes there will be "..." at the beginning and end, sometimes not, and the goal is to remove them if they are there? Use the trim()
  15. You said in your OP that you wanted to replace "..." with nothing. Now you're saying that "..." will change. Okay, so here's the deal: I'm not psychic, nor is anybody else around here. Rest assured, we are trying our hardest to fix that issue, but until then, if you want help, you are going to have to specifically mention what it is you're trying to do here. What will be at the beginning and end?
  16. okay well if you're just wanting to remove 3 dots from the beginning and end of a string, you can do this: $string = substr($string,3,-3); or this: $string = trim($string,'.');
  17. no. You can use javascript to detect it and send it to php, though.
  18. empty() assumes that the variables are defined, but empty. So if you don't enter anything in the form for them and they don't exist, you get the error because they are undefined. Try using isset instead of empty()
  19. That's because _ is a valid char for a variable name. Wrap your variable in braces {$user}_...
  20. replace it with what?
  21. I don't get it. Are you saying you are trying to open it up and edit it with php, like with file or something?
  22. As far as #1, you can use array_unique
  23. Of course it makes sense to you; you wrote it. But anyways, my intention was not to be some kind of grammar police. I read it and interpreted it a certain way that caused me to be confused, so I asked about it. You clarified it. Let's all get jiggy wid it. Na na nana nanana.
  24. okay so the problem is that you are NOT ordering your results randomly. Not even the first time. You have 2 queries in that script. The first one you have order by rand() but that's pointless since all you are doing with it is finding out the row count for your pagination. It's the 2nd query that you need to order by rand(), as that's the one you are actually getting the data from.
  25. A microsoft spy! A mole within the php organization!
×
×
  • 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.