-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
<form name='convertform' action='..' method='..'> <input type='text' name='creditsbanner' onkeypress='return validateField(event)'> </form> <script type='text/javascript'> function validateField(e) { return !(/[^0-9.]/.test(String.fromCharCode((window.event)?e.keyCode:e.which))); } </script>
-
If I am in a situation where an online virus canner is necessary, I usually go for Trend Micro.
-
well it looks like in your script you increment $scoree whenever there is a Correct answer and $intt whenever there is an Incorrect answer. So to get the total, just add those two up after the loop is done. $total = $scoree + $intt;
-
$subject = "whatever you are searching"; // this will find all of the items and put into $matches array preg_match_all('~\{([^\}]+)\}~',$subject,$matches); // alternatively, this will find the items and replace them with something $subject = preg_replace('~\{([^\}]+)\}~','replacement here',$string);
-
This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=329967.0
-
I was just going with the function that was originally suggested in the main post. I've updated my post to use array_reverse. fair enough. I almost did the same thing
-
@mattal999 : rsort() sorts descending alphabetically...not the same as outputting in reverse order.
-
well..only going by the code you posted, one way to do it would be foreach ($xml->channel->item as $item) { echo $titles[] = $item->title; } $titles = array_reverse($titles); foreach ($titles as $title) { echo $title . "<br/>"; } Though I have a sneaking suspicion there might be a built-in way to do it, depending on what you are using to get that xml object
-
what is the actual name of the array you are using (what you pre'd)? You would be using something like this: <span class="blue"><?php $array[0]['count']; ?></span> except replacing $array with the name of your array.
-
error is not because of your php script it is because of something "wrong" with your new database install. In your my.cnf file, try upping the connection timeout. /etc/my.cnf or ~/.my.cnf or wherever you have it, this line: connect_timeout=xx
-
Kind of like having real kids. With kid #1 you're constantly worried over every little thing. "Oh nohs, Jane bumped her head or got a scrape, rush to the ER!!! Won't stop crying, rush to the ER!!! Ate 1/4 too little or too much of her baby food, rush to the ER!!!" By the time kid #4 comes along you're just like "Eh, he'll stop crying eventually. Eh, scrapes and bumps happen, he'll live. Eh, he didn't eat as much today, he'll make up for it next meal or whatever, he's not gonna die. " Well that's how it happened in my household anyways
-
Well that's not really the root of the problem. Even if he was saving it on his own computer he would still be testing it through his browser, which would cache the content all the same.
-
I know you have taken some of the criticism here with open arms. And it's your right to accept/reject whatever advice/suggestions/criticism you get. Though if you think you know better, why post asking for help in the first place, except for...what, getting a pat on the back? If you are going to take any of it personal, then you can go somewhere else. We are most definitely not here to just scratch your belly and tell you what a good doggy you are. Yes, you have taken some of the advice and made some changes. Good job! But then you got all hostile about rejecting other things, and near as I can tell, your only real defense for those things is "But I spent a lot of time on this, it stays!" Are you even listening to yourself? Can you not see how illogical that statement is? I can spend an hour squeezing my butt-cheeks to the point of purple face and plop out a massive steaming pile of poo. And I can zip-loc that shit up and display it on my mantle for how proud I am of it. But it doesn't change the fact that it's a pile of shit, and that guests I invite over are going to call me out on it. You are making one of the most fundamental errors of web design - building/designing for yourself rather than your users. Bottom line is you asked for honest opinions, and you are getting them. If you cannot take being told your shit stinks by other people (read: people other than yourself) then you will never succeed as a web developer/designer. That's the cold, hard fact of running a business or succeeding a job in general. I'm sorry that you put a lot of time and effort into something, only to be told that it sucks. You are not be the first person to have spent a lot of time and effort on something that sucks. It's like when my son makes a drawing of the family with his crayons. He's all proud of it and he shows it to me and stuff. Does he think it's great? Yes. Do I think it's great? Yes, but not because it is a good work of art. I like it because it came from him and it has personal sentiment, and I makes me feel warm and fuzzy inside that he views me as being 100 feet tall because I'm that important to him. But that does not translate to being a good work of art, from a purely academic point of view. And if he asks me how good it was from a technical PoV, I will tell him it sucks. But more tactfully, because he's a kid. But you are not a 5 year old kid, are you? That doesn't give us license to call you personal names etc...and near as I can tell, the only one who got personal about it was you. It's up to you whether or not you heed advice/criticism. But either way, if you can't take the heat, then get out of our kitchen.
-
...did...did you just admit to having micropenis?
-
Yes, people actually make a living on short selling. Hmm last time I checked, shorts aren't usually made out of metal. Maybe the buttons or zippers sometimes...
-
Will need to replace the replacement w/ what you want but here is an example of the actual regex and a generic replacement example. $word = 'google'; $string = 'I really love google. you can access <a href="http://google.com">google.com here</a>'; $string = preg_replace('~('.$word.')(?!(??!</?a[^>]*>).)*</a[^>]*>)(?![^<>]*>)~','<a href="$1">$1</a>',$string); echo $string;
-
you don't *need* functions, but they make life easier. The point of functions is being able to reuse code. If you just have a single page doing a single thing, then there is little point in making a function out of it. But if you have many pages doing the same thing, it makes more sense to make it into a function and call the same function - have a single instance of the code instead of many instances of it. Why? For one thing, having 100 instances of the same thing is a waste of space. Also, what about having to make updates to it? If you suddenly need to make a change to the code, you would be making a change to it in 100 places instead of one.
-
well there are a million ways to write code for "a link". Can you post the actual "before" and "after" of what you physically want it to look like...
-
m tags work again
-
dunno if it'll fix your problem, but this line: if(!$types[$this->getExt()]==''){ should be if(isset($types[$this->getExt()])){
-
It's from the prototype framework. Basically it is an event handler. Many times you want something to happen at a certain time, like when the page first loads, etc.. you can use this to listen for it and execute what you want when it happens.
-
another filter... http://www.phpfreaks.com/forums/index.php?topic=228009.0
-
2 things: 1: Make sure you allow popups in your browser. Most browsers these days even out-of-the-box by default will either disallow popups or prompt you for directions on what to do about it. And that's just out-of-the-box. Many users have ad-blocker or anonymous web surfing type addons/extensions for their browser that will also block or prompt when a popup occurs. You should consider that when making your script - most developers these days do not rely or even bother with window.open() unless it is for a specific purpose that is absolutely necessary. Note: there really isn't very many situations where window.open() is absolutely necessary. I have no idea what you need this popup for so I can't really give you alternatives to it. But as far as the issue at hand... 2: Your window.location is redirecting before the popup has a chance to open. There are 2 ways to go about this and you basically have to pick your poison. You can timeout the redirect and give the popup a chance to execute. This version should give the popup enough time to load (you can adjust the timeout by increasing 500 to something higher (it is in milliseconds)). Key behavior of this is that if your browser is set to ask to allow the popup, if you don't respond in time, the redirect will still happen, whether or not your popup actually occurred. This may either be good or bad depending on your needs. <script language="javascript"> window.open('SuccessMessage.php?fullview=Y','','height=300,width=525,resizable=yes,scrollbars=yes');</script> <script> window.setTimeout("window.location='index.html';",500); </script> Alternatively you can wrap the redirect in a condition, where window.open() is what is evaluated. This will cause the redirect to only happen if the popup actually occurs, including waiting around to find out whether or not you accept the popup if your browser prompts you. Again, this may or may not be ideal for you, depending on what the actual purpose of your popup is for. <script language="javascript"> if (window.open('SuccessMessage.php?fullview=Y','','height=300,width=525,resizable=yes,scrollbars=yes')) window.location='index.html'; </script>
-
$string = "your string here"; $string = preg_replace('~\s*-[^-]*$~','',$string); This also removes space(s) before the last hyphen. If you don't want that then remove that \s*
-
sidenote...if you know that all you are ever going to want is the last one or two, then you can do as previous posters have shown. But if you want to be able to grab a variable amount, you will have to put those in a loop. The better way to handle this is to do something like this: // number of elements from the end you want $n = 2; // if you don't care about preserving array keys use this $outputArray = array_slice($inputArray, -($n)); // if you care about preserving array keys, use this $outputArray = array_slice($inputArray, -($n), count($inputArray), true); Then you will have $outputArray as an array of the last element(s) in your original array. You will be able to specify an arbitrary number with $n and just loop through $outputArray.