Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. There's a working example in the manual. Link has already been provided in this thread. Are you seriously wanting me to type out for you how to use a variable name to refer to its value? $name = "something"; echo $came; // why won't this work? echo $blah; // omg it still won't print 'something' echo $wtf; // wtf is going on, for the love of god, please just echo 'something' echo $mame; // ooh, ooh, I'm getting closer, I can feel it.... echo $name; // oh...there it is. I guess I had to spell it like 'name' cuz like, that's the variable's name
  2. I was just pointing out the fallacy of claiming people are smarter for not doing drugs.
  3. hmm...IMO if two people do the same stupid thing and one was high and the other wasn't, I'd say the sober person was stupider.
  4. Are you looking for that exact string (as in, checking if it's there)? Are you wanting to search for img tags in general? img tags with path but any filename? Any path, exact file name? img tags with any file name of .gif extension? Need more info.
  5. /(<(\/?)a[^>]*>)|(<img[^>]*>)/
  6. oh come on now... It tells you table2 doesn't exist because table2 is obviously not the name of your table.
  7. You would run this query: select table2.id, table2.name from table2 left join table1 on ( table1.id = table2.id ) WHERE table1.id IS NULL Ah! Now why didn't I think of that. I was staring at my test table results with the NULLs and it just didn't occur to me... you are the man.
  8. some sql dbs offer a rank() function(or construct or whatever) that more or less does exactly that. mysql is not one of those dbs.
  9. Ah, but that's the thing. Funny thing about marijuana is that 99% of the time I see Pro-Pot-People (People who are 'for' the idea of legalized pot. Not necessarily pot smokers. Henceforth I will refer to them as PPPs) arguing it's legitimacy, it's always in the context of comparing it to worse things. But allowing a "lesser evil" on the basis that a "greater evil" is allowed isn't very logical. And for those who don't know, the govt. did try to ban alcohol at one point in time, but due to people yelling and screaming and protesting and ignoring loud enough, they brought it back. I do not see legalization of marijuana as a recreational drug (like alcohol or cigarettes) happening any time soon. Especially since PPPs are foolishly trying to push the 'medicinal purposes' argument. I'm not saying it doesn't have medicinal uses. What I am saying is that since PPPs are trying to legalize it because of that, it's going to wind up on the shelf as a prescription drug, just like every other 'feel-good' prescription drug. How many prescription drugs do you see downgraded to over-the-counter? Not very many. Only a handful of states even recognize it as a prescription drug, and it's not recognized on the federal level. It's going to take time for it to even be legitimized as a prescription drug across the board. And even after that, they aren't going to turn around and over-the-counter it the next day, when it took them all that time to put it at prescription status. And that's why I think that the PPPs are being foolish by pushing the medicinal value argument. They think that this tactic is getting their foot in the legal door, when all it's doing is pushing up the date of when it reaches over-the-counter status. And again, I'm not necessarily disenfranchising it's medicinal value. But come on. We all know that most people are getting prescriptions for it in much the same way they get prescriptions for other things they want to enjoy. They go to some PPP doctor and recite the magic words he needs to hear to legally give him the thumbs up. Vague "It"-hurts symptoms are good enough. Throw in a wink-wink-nudge-nudge for the punchline to this joke of a process. And let's say that tomorrow pot is legalized. What happens to all the people with records or on probation or in rehab or in jail because of pot? People will argue that it's not their fault the govt. was slow to realize the err of their ways. Why should they continue to be penalized? People will demand that prior records be destroyed. People will demand to be released from probation, rehab and jail, and rightfully so. It's like if I were to put my kid in the corner for running in the house. While he's in the corner, I decide that running in the house is not such a bad thing after all. Is it fair that he continues to stay in the corner? This is not a valid reason for not legalizing it. I'm just pointing out that it's not as simple as just saying "Okay, it's legal." Another thing I think PPPs fail to consider, is what exactly will happen, economically. They think that Uncle Sam will throw a heavy tax on it like they do with cigarettes and booze, everybody's happy, the end. So what happens when sales go down for the pharmaceutical, alcohol and tobacco companies (Though I guess it could be argued that tobacco companies might see an increase in sales, if anything)? Do you really think that these huge, multi-billion dollar industries are going to sit on the sidelines and do nothing about that? No, they are not. In fact, they aren't sitting on the sidelines right now. I guarantee you that they are the ones fighting the most to keep it as controlled-substance status right now, and it's not because they feel it's bad for you or morally wrong. It's because it will hurt their pocket books. And yes, the govt. does stand to get extra income for legalizing it (by taxing it). But do they feel it's worth the trade-off? As it stand right now, marijuana as a controlled substance. But a lot of people smoke pot. A lot. Keeping it illegal gives the govt. a certain amount of control over people. It gives them the option seeming cool by turning a blind eye to 'minor' offenses, as well as wtfpwning you at their discretion. I'm sure many people will write that off as paranoid rantings towards "the man," but I've been in too many situations that involve cops and weed to think otherwise. Anyways.. as far as whether I personally think it should be legalized.... I'm not 100% sure where I stand on that. I mean, I certainly agree it's not as bad as alcohol or cigarettes or especially any number of other prescription drugs (seriously, read the possible side effects and warnings on that stuff. SCARY). But as mentioned before, being the 'lesser of the two evils' does not a 'good' thing make - It's still an 'evil.' I'm personally not sure whether I feel it's 'evil' or not. Plenty of times I have been high or have had my life revolve around being high to the point that it was counter-productive to what some would call "Being an outstanding citizen." But I do not necessarily attribute that to being high on pot, specifically. I feel that it could have just as easily been something else. It is something else for many other people. In fact, it doesn't even have to be a 'drug' that causes deviant behavior. Any hobby or ideal can be taken to extremes. I've been sober for a long while now. I do not think I'm gonna run out and buy a pack of marijuanettes just because the govt. makes it legal. And I feel sorry for the people who will. That is, I feel sorry for the people who decide whether something is right or wrong, based on what the govt. says. But that's just me. So in that capacity, I really don't care whether it's legalized or not. If I light up, it's going to be because I feel in my own heart/mind/whatever that it's okay, regardless of it's legal status. p.s.- I think the 420 culture is retarded, but that's a whole other TLDR post.
  10. str_replace accommodates mixed data type arguments (string, string | array, string | string, array | array, array). There is no problem with multi-array-replacements. The problem is that he put { } around the array, which is the same problem the code you provided is going to have, because you put { } around your vars, too. There's only 2 reasons why there would be { }. 1, is if he was trying to encase the pattern in a delimiter. Since str_replace looks for an exact match, it does not use delimiters. And even if he were to use for instance preg_replace, which does use delimiters, he still did it wrong. He would need to put them around each individual array element in his $tags array, like so: $tags = array( '{TITLE}', '{NAMETO}', '{NAMEFROM}', '{MESSAGE}', ); But again, str_replace does not use delimiters. 2nd thing is if he were trying to prevent ambiguity. For instance, f you're using a variable inside quotes, for example: "blahblah{$var}blahblah" but that doesn't work any more than trying to echo an entire array. It will just echo 'array' echo $tags; // output: array echo "{$tags}blah"; // output: arrayblah echo $tags[9]; // output: TITLE echo "{$tags[0]}blah"; // output TITLEblah Your code puts { } around each array element. But to str_replace, that's not the same as doing echo "{$tags[$x]}"; Though even if it were, it would be pointless, as there's nothing else in the string to create ambiguity. What str_replace sees that as is "{TITLE}" so it looks for that literal string, which it won't find unless the document in question formats it like that. Which now that I think about it, is a possibility, since he was obviously trying to do something with those brackets. If that is the case, instead of hardcoding an array and then turning around and looping through each element, just hardcode the {}'s in the array elements to begin with
  11. Make sure you validate $string if you're getting that from user (like from a form). $string = "22-12-6+5"; eval("\$sum = $string;"); echo $sum;
  12. echo str_replace($tags, $data, file_get_contents('emailmessage.html'));
  13. As premiso pointed out, you're forgetting the whole wrap your stuff in a class thing... class something { // declare properties here, example... var oops; var server; var user; // etc... function blah() { // do stuff here } } // end class something
  14. My first guess is that you're missing the = in your href='...' <a href=\"download.php?id=<?php echo $id;?>\"><?php echo $id.".<nbsp><nbsp>".$name;?></a><br/> Also, you're going to have to wrap your code before the if(GET...) to only show if GET doesn't exist, otherwise you're going to get some header errors when that condition evaluates true...
  15. <?php $html = <<<HTMLSTUFF <html> <head> <!-- header stuff here --> </head> <body> more blah blah blah <a href='http://www.ohtehblah.com'>blah!</a> </body> </html> HTMLSTUFF; echo $html; // example 1 echo "<pre>"; echo htmlentities($html); echo "</pre>"; // example 2 echo "<textarea cols = '80' rows = '10'>"; echo htmlentities($html); echo "</textarea>"; ?>
  16. google html header info
  17. //Get the name from the URL $username = mysql_real_escape_string($_REQUEST['name']); //Get data from the database $sql = "SELECT v1.name, COUNT(v2.exp) AS rank FROM table v1 JOIN table v2 ON v1.exp < v2.exp OR (v1.exp = v2.exp AND v1.name = v2.name) GROUP BY v1.name HAVING v1.name = '$username' ORDER BY rank"; $result = mysql_query($sql) or die(mysql_error()); if ($row = mysql_fetch_assoc($result)) { imagestring($im, 5, 0, 0, $row['rank'], $textcolor); } else { // username was not found, do something } // end if..else $row
  18. If you can login here then you can login to the main site, as they draw from the same table....
  19. as premiso said, $this refers to the class in which the method/property resides, and you can only use it inside the class like so: class something { var foobar; function blah () { $this->foobar = 'blahblahblah'; // works, because it refers to foobar in this class } } $this->foobar = 'blahblahblah'; // does not work, because 'this' refers to nothing.
  20. Show your code again let's see what you have now.
  21. table1 id 1 2 3 table2 id name 1 a 2 b 3 c 4 d 5 e He has 2 tables basically like that. He wants to return all rows from table2 where table1.id != table2.id so returned results would be 4 d 5 e I'm not sure I understand how a left join would work? If I were to do select id, name from table2 left join table1 on table2.id = table1.id I'd get 1 a 2 b 3 c So I assume if I did select id, name from table2 left join table1 on table2.id != table1.id I would get 4 d 5 e But that's not the case... I guess I'm not understanding the concept...
  22. okay it echoes 4 because you tell it to echo num_rows here: echo mysql_num_rows($result); and then your while loop never gets executed because you kill your script with this: die();
  23. well it makes more sense to use a dropdown so you don't have to worry about case sensitivity or mispelling when trying to 'convert' a name to an id later on.
  24. Here try this query instead: select id, title, adlink from survey where id not in (select survey_id from completed_surveys)
  25. Okay...so the only reason I can think of that that would happen, is if completed_surveys has a row for all the surveys in it - that is, all your surveys are complete.
×
×
  • 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.