Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. What have you tried so far? This can be done in a single line of javascript right in your input tag.
  2. Not sure if this is even possible because there's no real way for MySQL to say "show me every row which matches col=val, ordered by col2, but only the first 3 for every distinct value in col1." You may want to just pull all the scores for any player with more than 3 scores, sorted by score DESC, and loop through them in PHP, skipping any unnecessary rows. That seems wasteful, but i can't see a purely SQL solution to your problem.
  3. Then...you're doing it wrong. You're really expecting an answer when you've given us a single line of code straight from the manual and you say it doesn't do what the manual says it will? Debug this. Are the arguments in the right order? Did you print a before and after? Is there other content on this page? Etc. So far your answer is "str_replace works, you're doing something wrong."
  4. You cannot do it. If you're having to ask such basic questions, you can't do it. if you're found to be responsible for a credit card data breach, your life is over. You will go bankrupt, and maybe to prison. Outsource this to a company that knows what it's doing, like google checkout.
  5. The session cookie is generally not stored by the system on the drive, it's stored in RAM. You need all cookies. Snoopy is a PHP class which masquerades as a browser, that might be easier for you.
  6. I normally use print_r($var,true) for dumping. var_dump really only gives me useful information on booleans.
  7. Always always always view the source when you var-dump.
  8. What...what are you wanting these items to be? As far as I can tell, json_object will be an object that just contains the string "data". This matches your output (but not what you say you want). json_array will be an array of all the twitter posts you're fetching from somwhere. This, again, matches your output. You probably want... function get140Sentiment ( $tweets ) { $item_type = "data"; $data = array('data' => array()); foreach ( $tweets as $tweet ) { $data['data'][] = array('text'=> $tweet->tweet_text); } $json_object = json_encode ( $data, JSON_FORCE_OBJECT); $json_array = json_encode( $data ); var_dump($json_object, $json_array); }
  9. Checkboxes need to be checked in order to pass information. You shouldn't use checkboxes for this anyway though, the session is more correct for passing data between page loads.
  10. Take out the "or die". It's causing your page to...die.
  11. print_r($_POST, 1) would show nothing...unless you put it inside the rest of the statement like you were asked to do. Why not able to solve the issue is because you're not giving us any information. Copy and paste the command you were given. Show the output. It absolutely 100% will always print something. Show us that something.
  12. Someone asked you to print_r post.
  13. You need to pay someone to do this. Because you don't know how, any solution you come up with could be circumvented by anyone with higher skill than you. If you use file_get_contents(), you'd have to either use eval() (which is wrong) or force your clients to turn on allow_url_fopen and require() a remote file (which is not only wrong, but a serious security flaw). Even so, I could just as easily pull that file down by hand and replace your security code with a local version. The only true way to protect your PHP code is to not give it to anyone. Have this demo or whatever run on your server, don't distribute the code.
  14. Yeah, I guess so. Plus, from the filenames it looks like an old school file explorer application. It would be more trouble than it's worth to rewrite it.
  15. PHP is not a compiled language, it is interpreted. The source code is always available. There are expensive products like ioncube which attempt to obfuscate the code so something like this is possible, but it's not possible to simply push a button somewhere and "lock" your source code. As an aside: I would never buy a product which relies on your server being up in order to work.
  16. number_format does what you want, but it puts a 0 before the decimal. If you wish to remove it, you should wrap your decimals() function AROUND the number_format function. Functions in programming languages are called inside-out, the innermost ones are resolved first.
  17. ...what didn't work about it? Number_format is exactly what you want.
  18. Steve, you should try out EclipsePDT. It's free, and it's a real IDE.
  19. If you don't want to be big fat cheaters, the way to do this on paper is to use the quadratic formula For this equation, it's as easy as: y = x*(x-1)*5; y = 5x^2 - 5x; //jesi, you messed up here by moving X back to both sides of the equation. Don't do that 0 = 5x^2 - 5x - y; //everything has to equal zero //here, we substitute Jesi's value for Y and use the Quadratic Formula x = (5 +/- sqrt(25 - 4 * 5 * -60)) / 10; x = (5 +/- 35) / 10; x = 4,3; The parabola formed by the equation cuts the Y axis at 4 and 3. Both are valid answers, but only the larger one satisfies the original equation. Also, I just now noticed this thread is 6 months old and newbie here bumped it, but I did all the math so you're getting the post anyway.
  20. You have bugs in this code that would have thrown errors 12 years ago had you turned error-reporting on. Put this at the top of your script: error_reporting(E_ALL); Then start from the top and fix every warning and error. You also have blocks in here which are unnecessary, like your switch to determine the month of the year. wren_functions.php probably has more problems. You should also tell strangers what "bombs out" means, since we're not sitting next to you able to actually read the errors that you can see.
  21. You shouldn't be using frames in the first place.
  22. Christian is right. You're also using a lot of buzzwords that make no sense. PHP scripts are not applets. There's no such thing as a "data bounds." And you need to read up on how PHP handles comparisons between data types
  23. Why are you not simply using the function provided?
  24. The "lightswitch" in the top left of the rich text editor turns it off permanently, but also disables the CODE and PHP buttons. However, since the editor doesn't seem to be chrome compatible, it's better than leaving it on. As for the quicklink to the filter, you can bookmark this link, which is the direct link to "show only items I participated in which are unread." The filters show up in the URL when you refresh.
  25. Unfortunately, these solutions won't work because my girlfriend's birthday is TODAY, but her birthdate is not within 3 days of today, it was 20 years ago. You need to combine the date_format functions and the str_to_date function to change their birthdates from the year of their birth to this year, something like: WHERE STR_TO_DATE(CONCAT_WS('-', DATE_FORMAT(NOW(), '%Y'), DATE_FORMAT(birthdate, '%M'), DATE_FORMAT(birthdate, '%D')) BETWEEN DATE_SUB(NOW(), INTERVAL 3 DAY) AND DATE_SUB(NOW(), INTERVAL 3 DAY) Might not be correct, it's been a while since I actually wrote a query, but you get the idea.
×
×
  • 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.