-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
no...my way works just fine. You just failed to understand and apply the principle.
-
function email_db_error() { $to = "[email protected]"; $subject = "db error"; $content = "The following error occured on: " . date("Y.m.d H:i:s") . "\n\n"; $content.= mysql_error(); mail($to,$subject,$content); } // example $conn = mysql_query('blah') or trigger_error(email_db_error());
-
wtf you're supposed to be making a crystal ball smiley quit slacking. FOCUS!
-
in general, you can look for patterns in your script and consolidate. For instance, I see that most of your queries/conditions seem to do pretty much the same thing, only columns and messages changing. All of that can be consolidated into a single function with a few params passed to it.
-
[SOLVED] PHP mail form issues (easy stuff)
.josh replied to Hybridmoments82's topic in PHP Coding Help
your condition checks for a submitted variable named "submit". you have: <input type="submit" value="Send" /> you didn't actually name it "submit" it should be <input type="submit" value="Send" name="submit" /> Also, there's nothing in your condition that actually mails anything to anybody. -
umm...I think you're missing the point...
-
Wish you the best of luck in getting an answer...but fyi you are going to be hard pressed in finding someone willing to sift through a bunch of code and recommend what can be done better. At least, for free, anyways...
-
not 100% sure what you are wanting to do here but maybe mod rewrite might be what you're looking for
-
be more patient? Are you hardcoding the options, or are they stored in your db or something and you loop through echoing them out? If so, put a condition in the loop and check for it. If not, put the options in an array, loop through it and check it. Example: $options = array('a','b','c','d','e'); $storedOption = 'c'; foreach($options as $option) { $selected = ($option == $storedOption)? " selected='selected'" : ""; echo "<option value='$option'$selected>$option</option>"; }
-
to get browsers to cache images you do...nothing. Most browsers will cache by default, unless the user changes their browser settings. You can't really make a browser cache an image, though you can try to get it to not cache by virtue of trying to make it request for it on every page load.
-
did you actually try the code posted? Using the example content in your OP (and adding a bit to it for example sake), this.... $content = <<<BLAH <h3>title here</h3> <div style='width:515px;'> <img src='images/images1.jpg' id='imgr'> <p>first paragraph of text here</p> blah blahblah <p>first paragraph of text here</p> more blah <p>another one here</p> <img src='images/image2.jpg' id='imgl'>... BLAH; $content = str_replace("\n","",$content); $content = preg_replace('~<[^>]+>~',"\n",$content); $content = explode("\n",$content); $content = array_filter($content); echo "<pre>";print_r($content); produces this: Array ( [1] => title here [5] => first paragraph of text here [6] => blah blahblah [7] => first paragraph of text here [8] => more blah [9] => another one here [11] => ... ) Is that not what you want? (edited to fix code tag)
-
It's called a ternary operator. I do not like using it for complex conditions (especially disagree with nesting them) for non-readability purposes. But for simple things like assignment of something vs. a default, or as a simple switch, I'm all for it.
-
Also, might wanna throw in a str_replace for \n's already there, to avoid multi-line content being broken into diff array elements: $content = str_replace("\n","",$content); $content = preg_replace('~<[^>]+>~',"\n",$content); $content = explode("\n",$content); $content = array_filter($content);
-
What about... $content = preg_replace('~<[^>]+>~',"\n",$content); $content = explode("\n",$content); $content = array_filter($content);
-
So if we are not human, then what are we?
-
Try changing this: $search = "chr(13)"; $replace = "chr(10)"; $data = str_replace($search,$replace,$data); to this: $search = "\r"; $replace = "\n"; $data = str_replace($search,$replace,$data);
-
I want to visit Ireland some day. I'm like 50% Irish. The other 50% is asshole. I guess that really makes me like 75% asshole...
-
I thought political debates in Ireland only extended as far as who can drink who under the table?
-
Honestly I do not know a whole lot of people these days who hate other people solely because their skin color is different. People these days may do a lot of stereotyping but it's based on behavior, culture, habit, belief, philosophy, etc... which makes this whole "racism" business a big gray area. Yes, it exists in the capacity that one assumes someone will act/do something/"be" a certain way because they are xyz color, but the beef is with the person is really the action/thought/whatever, not the skin color.
-
If we are super beginners and you are not, why are you asking for our help?
-
$a = preg_replace('~<a class="test">(.*?)</a>~','<b>$1</b>',$a);
-
the zend framework itself is free and open source. But they offer a bunch of things for $$ like support, an IDE, etc... one of the (supposedly) great things about the zend framework is that the zend company was founded and basically run by some of the devs who made php.