Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. I would give the user a series of rows that are formatted like this: {sel_days_s} to {sel_days_e} from {sel_hour_o} : {sel_min_o} {sel_ampm_o} to {sel_hour_c} : {sel_min_c} {sel_ampm_c} Each of the {...} represents a drop down field. You place the days of the week Mon. through Sun. in the sel_days_[s|e], the hours of the day in sel_hour_[o|c], and fifteen minute increments in the sel_min_[o|c] fields. When the user fills out the form, if they select a start day but no end day, then they are defining the hours for a single day. If they select a start and an end day then they are defining the hours for a range of days. You could just pre-load the page with 5 or 6 rows of inputs or this would also be a good place for some DOM-manipulating Javascript to allow the user to add and delete rows as necessary.
  2. I too would recommend fixing your road rage habit; as suggested I would look into anger management as I doubt being cut off on the road is the real source of your anger. More likely its just a trigger for deeper aggression. Anyways, you'd be surprised how quickly your life could change during the 3 seconds you get into a fight with someone. I know of at least one person who followed someone after a road incident with the intention of starting a fight and had a gun pulled on them. I know at least two dozen people who will do anything they can to avoid a fight, but if needed wouldn't think twice at breaking your knee, elbow, and knocking your jaw right off your head to defend themselves or their families. Food for thought.
  3. This tells me that you think is it better to use crappier code if it is cheaper than well designed code that cost more. If that is true please explain that to me. I always think its better to use efficient, well designed code for the exact reasons you point out: it's easier to update, maintain, support, expand, etc. However, it is still not their loss to go with crappier code at an initially cheaper cost, even though it likely costs them more in the long run. Like I said, they budget for additional time on top of what any developer tells them simply because they know every software system will always need to be revisited. As long as they stay within their budget and time constraints, they haven't lost anything. Also consider this. A large initial bid from a seasoned veteran vs. a cheaper bid from Joe Coder for what the company considers a prototype system, i.e. a test to see if there is market interest. Of course they go with the cheaper guy (again) because if the system flops or the market has no interest, they've only lost a small portion of time and money. Going back to who the loser is, it's the perfectionist. I don't have to tell you how much lost time and frustration muddling through someone else's bad code has cost me, I'm sure you've been there. The good coders are the losers. Tell me how many times this scenario has been played out: The coder is the one that suffers; they feel disheartened that the program "isn't all it could be." The business person lives on in blissful ignorance. The trick to the whole thing that I'm learning is unless the program is your brain-child, i.e. if your just an employee in a company, stop beating yourself up over stupid decisions made by management.
  4. Click the stop button on your browser?
  5. There's a chance you have multiple directories where the .dlls should be installed? For example a distribution might have one directory for php5 .dlls and one for php4 .dlls. Make sure you put the .dll in the one your PHP is using.
  6. I'd have to disagree that it's their loss. Sure the code is "low quality," but as long as it runs its not a problem. Look at it from their point of view, any program requires the following: * support * updates * maintenance * improvement It really doesn't matter how flawlessly designed a system is, you will always have to go back to it. Smart business people will budget for the cost incurred of doing this, much like retail stores will budget for a certain percentage of merchandise to be shop lifted. So let me pose a couple scenarios to you: Let's say two coders bid on a project, one is fairly novice and the other a seasoned veteran. There is a good chance the veteran's bid will be higher. Now the business-minded person is faced with two bids, one substantially smaller than the other. They've already made a mental decision based on experience that you take the initial bid, multiply by (let's just say 1.3) for the extra cost of maintenance and adding additional features over the next few months. Well the novice is still cheaper. Now let's say one developer inherits another's project, a common scenario. The new developer will always be inclined to say, "There is a lot of stuff that needs to be done before we can continue." The business-minded person will always be inclined to coerce you into jerry-rigging what currently exists, since it is cheaper. In all cases, the business-minded individual is only concerned with costs and gains, nothing more. They never look at any of the code; the developer is the one that suffers through Hell because of a bad design, the business person still doesn't give a shit. Most never will.
  7. Works fine for me. <?php if(!empty($_POST)){ echo '<pre>' . print_r($_POST, true) . '</pre>'; } ?> <html><head></head><body> New Part Number: <form name="sform" method="POST" action=""> <input type="text" SIZE="20" name="ADDPARTNO" /> <input type="submit" name="submit" value=" ADD PROVIDED NUMBER " /> </form> Part Number Series: <form name="aform" method="POST" action=""> <input type="text" SIZE="20" name="SERIESPARTNO" /> <input type="submit" name="submit" value=" ADD SERIES NUMBER " /> </form> </body></html>
  8. I don't disagree, but the person who dictates the salary often has limited technical experience. The world to them is simply losses and gains; they will always strive to pay as little as possible to get any project completed and honestly, none of them care how it was done as long as it works. Considering that PHP and Java don't have as steep a learning curve as C or C++, it's no wonder the market is flooded with people that can use them. So from the pure business standpoint of "This is my budget and this is what I need," why would anyone pay you $100k / year when they could pick up a freelancer that will work for much, much less? Only in the rare cases where the project manager, company owner, etc. comes from a technical background do people really get paid what they're worth.
  9. I would argue that the average c / c++ developer might know more about programming than the average Java, PHP, etc. programmer. Those languages require more work to accomplish many of the same tasks and you have to program very carefully to not make any memory mistakes.
  10. Well in which table? What do you want to update it to? And with what criteria do you wish to choose which one to update? All of that is sort of important information in solving the problem.
  11. Do you mean color.id or color_id? There is a big difference. UPDATING and SELECTING are two different things. Are you trying to run a single query to update color_id in multiple tables? If so, which tables do you want to update?
  12. header() is a PHP function that allows you to set the headers sent to the browser. I don't know which header, but there is one that controls the browsers ability to cache a page. You might look through the PHP help forums for header questions, or google or wikipedia. As an example, if I wanted to redirect the user's browser to a new URL from PHP I could do this: <?php header('Location: http://www.yahoo.com'); exit(); ?> That code in any PHP script will send the user to yahoo's home page. I know this is irrelevant to what you want to accomplish, I was just giving an example of how the function is used. Instead of Location:, you need to supply the parameter that controls the browser cache. Instead of the URL you need to provide a different value that says, "Don't cache this page."
  13. What do you want to update?
  14. I'm not going to bother reading all that code as: 1) It's not in [ code ] tags and 2) There's way too much of it. But here are a couple of suggestions. Are you 100% positive it is the browser's cache that is causing the problem? If you are, you can probably use a call to header() to tell the browser to never cache that URL. Also, when you use AJAX to query the database, is your PHP script returning [X]HTML or JSON? If you are returning [X]HTML I would advise that you look into JSON. JSON stands for Javascript Object Notation. It is much, much more convenient for returning data in AJAX requests.
  15. ENGINE=MyISAM Sets the table's engine to MyISAM. MySQL supports several engine types, MyISAM is one of them. CHARSET=latin1 Sets the character encoding for the table. This is important for text comparisons and other things, not really my specialty. AUTO_INCREMENT=1 The table has an auto incrementing field named `id`. This tells the table to start with the number 1. The table would have done this anyways, so this is redundant AFAIK.
  16. Well you are no longer echo'ing anything, so why is the dot still in your query? Usually when you try and fix a problem, this applies to all problem-solving and not just programming, the more information you have about the problem the easier it is to solve. Until you get it resolved, change your code to give you more information: $sql = 'UPDATE price SET drugs = 10000 / (.$num_steaks)'; mysql_query($sql) or die($sql . ' : ' . mysql_error()); $sql = 'UPDATE price SET steaks = 20000 / (.$num_steaks)'; mysql_query($sql) or die($sql . ' : ' . mysql_error());
  17. SELECT v.`color_id` FROM `xcart_variants` v INNER JOIN `xcart_variant_items` i ON v.`variantid`=i.`variantid` INNER JOIN `xcart_class_options` o ON i.`optionid`=o.`optionid` WHERE o.optionname='some option'
  18. Does exactly what I described here: http://ns2271.serverpowered.net/test/ietest.php Type hello in the box and immediately hit enter. Then type hello in the box and click on the button. <?php if(!empty($_POST)){ echo '<pre>' . print_r($_POST, true) . '</pre>'; } echo <<<HTML <form action="" method="post"> <input type="text" name="the_text" size="16"/> <input type="submit" name="the_submit" value="Go" /> </form> HTML; ?>
  19. Here's an attempt to answer the OP's question, rather than concerning myself with many of the side-arguments that are evolving here. It's not; every PHP-based web site can be written procedurally without a single line of object oriented code. The shortest answer is: OOP makes your life easier; you should always be interested in things that make your life easier. Given that there are hundreds of books on the subject, there is absolutely no way all of your questions about OOP can be answered in a single thread. I suggest you do some independent research on the subject via internet tutorials, articles, etc. or just buy a book on the subject.
  20. Here it is with basic error handling: <?php /** * Search for the aa element that has the specified values in * aaa and bbb and delete it from the document * @param object the dom object * @param string the aaa node value * @param string the bbb node value */ function delete_aa($dom, $aaa_val, $bbb_val){ $aas = $dom->getElementsByTagName('aa'); if(empty($aas)){ return; } foreach($aas as $aa){ try{ // Get the aaa and the bbb of this node $aaa = $aa->getElementsByTagName('aaa')->item(0)->nodeValue; $bbb = $aa->getElementsByTagName('bbb')->item(0)->nodeValue; if($aaa === $aaa_val && $bbb === $bbb_val){ // Match $aa->parentNode->removeChild($aa); // break; // Uncomment this line if you want to end the search here } }catch(Exception $e){ continue; } } } ?>
  21. I've never used the DOM functions in PHP, but I've used them quite a bit in Javascript. Based on what I know there and what I got from the code you posted, this might delete an aa node given the aaa and bbb values: <?php /** * Search for the aa element that has the specified values in * aaa and bbb and delete it from the document * @param object the dom object * @param string the aaa node value * @param string the bbb node value */ function delete_aa($dom, $aaa_val, $bbb_val){ $aas = $dom->getElementsByTagName('aa'); foreach($aas as $aa){ // Get the aaa and the bbb of this node $aaa = $aa->getElementsByTagName('aaa')->item(0)->nodeValue; $bbb = $aa->getElementsByTagName('bbb')->item(0)->nodeValue; if($aaa === $aaa_val && $bbb === $bbb_val){ // Match $aa->parentNode->removeChild($aa); // break; // Uncomment this line if you want to end the search here } } } ?> (edit) I didn't perform any error checking in that code; I left that up to you.
  22. I do that on occasion, mostly when I was in school and bored, not so much now. I'm a "germy" person. I don't share food or drinks with anyone other than my fiance and I give her Hell whenever she does it with anyone else, mostly her sisters. My typical quote is, "I don't need your sisters herpes." (No, neither of her sisters have herpes, AFAIK anyways.) In public restrooms I try to touch as little as possible, some of them I won't use at all. I get annoyed whenever the door is one that I have to pull rather than push, because it means I have to touch it with my hand. If I do have to open the door with my hand, I'll use paper towel on the handle and hold it open with my foot while I throw the paper towel away. If there isn't a trash near the door I usually think, "What idiot designed the bathroom?" I'm not a total germ freak though. I clean the litter box at home and occasionally have to clean the bathroom at the karate dojo I train at. I just get really particular about certain places.
  23. I'd have to disagree. Inputs of type button or submit are almost always given a value attribute, so the question is when a form is submitted do you send all of the button / submit inputs or just the one that was depressed? Most browsers default to the one that was depressed. So when submitting a form with a single button / submit input, we'd expect to see it in $_POST. Now, if you have a form that consists purely of a text input and a submit button, does the specification say that pressing [enter] while focus is in the text input that the form should be submitted? I would guess that it doesn't, but most browsers do support that behavior. So, if pressing enter causes the form to be submitted, why would the button not be sent as if it were clicked? It just seems counter-intuitive to me. Also, it's not mentioned in my OP, but the submit button does have a value attribute set. MS does follow outside specifications in some areas, but I don't think this is one of them. Also, when they do decide to follow standards, they usually pick the most obscure parts of the specification that make the developers' lives torture.
×
×
  • 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.