Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. Try running your query directly in phpMySQLAdmin. Also, why do you have a WHERE 1 clause? It's redundant.
  2. Which is what AbraCadaver described.... Are you wanting to do this in PHP because you don't know JavaScript? I ask because I'm getting a strong "I don't know JavaScript, so I'm going to throw a bunch of JS scripts at the wall and pray one of them sticks" vibe from this whole thing. To flesh out AC's example, it should be as simple as: var selectElem = document.getElementById('mySelect'); selectElem.onchange = function(){ var value = this.options[this.selectedIndex].value; if(value === /* something */){ // toggle div } } Assuming you're using an actual HTML select element/drop down.
  3. Fixing it requires you taking the PHP code out of the query. You need to put your query in its own variable, and build it through that. $query = "SELECT * FROM productfeed WHERE 1"; if(isset($description)) { $query .= " AND description = $description"; } // etc. for other dynamic clauses $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { // do stuff }
  4. Ugh, Dreamweaver code. Yuck. I'm still not 100% certain how you're expecting PHP to do this. It would take either a page refresh or Ajax to have PHP determine which div to show. Remember, when your page is rendered on the screen, PHP is done running. It doesn't have interactive capabilities like JavaScript.
  5. Your query has syntax errors. Specifically, you're attempting to use PHP code (if(isset(....))) within it.
  6. Can you show more code? Specifically your swap function? It's hard to tell exactly what you're trying to do.
  7. Pseudocode: if (isset(/* var */) && !empty(/* var */)) { // do stuff }
  8. I guess I'm just not entirely clear as to why you need to keep the address clean. I'm getting the feeling that your design may be flawed. Also, if you're scrubbing the address, why wouldn't you want to use post instead?
  9. The method you should use depends on what you're trying to do. If you're passing data in to simply retrieve related info (e.g., using an id number to retrieve a product from the db), use get, a.k.a., query string appended to the end of a URL. If you're passing data in to insert/update/edit something, use post. This will keep your site semantically correct.
  10. $_GET['price'] will be equal to the string '1-300'. Not only that, you use that string value twice in your query. You need to get a hold of the numbers themselves. explode should do the trick.
  11. Output also means any PHP print or echo statements executing before the header call.
  12. I think the word you're looking for is procedural, not predefined. To the OP, safer how? Both OOP and procedural programming can be messy and unsafe if written badly. Simply creating classes and objects 'just because' doesn't convey any real benefit. OOP done right promotes reusability and modularity, but getting to that point requires more than learning syntax.
  13. Globals are bad in general. Never use them, as they ultimately make code unmanageable. Pass everything your function needs in order to work through its argument list. If you need to use a value that was created/calculated from within the function outside of it, return it.
  14. Hmm... it could be, like I said before, an event bubbling issue. http://www.quirksmode.org/js/events_order.html
  15. When you say 'hovered over the drop down', do you mean the mouseout effect is running when you're still hovering on comp_list, or comp_drop?
  16. So long as the OP isn't changing the value of the variable. Something like: $email = $_SESSION['email']; $email = "My cat's breath smells like cat food."; Won't automatically update the session's version of the email. Seems obvious, but I've seen others have issues like that in the past.
  17. So, is the menu not showing up at all? For IE browsers, you need to use a little JavaScript for it to 'turn on' HTML 5 elements: http://dev.opera.com/articles/view/new-structural-elements-in-html5/#older-browsers Also, as a tip, never, ever, ever use Comic Sans on a site that's not a comic book. Even web comics have moved away from it for their dialogue bubbles. It certainly doesn't belong on a professional site. There are far more modern and/or classy fonts to chose from. It sticks out like a sore thumb on a site that is otherwise visually appealing. EDIT: http://www.comicsanscriminal.com/
  18. EDIT: What element is comp_list? And what's its relationship to comp_drop? I'm thinking there's an event bubbling issue at play here.
  19. The easiest, most straightforward way to do it would be by using jQuery. Otherwise you have to go through all the hoops of doing all the tedious low-level work yourself. That said, it is a good idea to see exactly how it works under the hood, even if you're not going to go that route. So, look at jQuery first to see how easy it can be, and then look up a tutorial on Ajax and JSON for the details. Google will provide all of what you need if you search.
  20. Not with PHP itself. By the time you see the web page, PHP is done running. It won't 'see' form values unless they're submitted. You'll need to use JavaScript and Ajax to grab the text field's value and pass it back to the PHP script for processing.
  21. The question is whether this file is included in another. What little context we can see leads me to believe so. Regardless, it's quite clearly a 3rd party script, and a bad one at that. Whoever wrote it clearly doesn't understand basic OO principles.
  22. $this is a PHP keyword which is only allowed to be used within a class. It seems as though your file is supposed to be part of an OO system, but something got mucked up somewhere so it's not actually a class.
  23. Unless you're printing or echoing it, you need to exit PHP.
  24. I'm not going to do all your homework for you. You should be able to easily make 50 'ABC' words with minimal modification to what I already gave you. In fact, it takes only an additional 2-4 lines of code.
×
×
  • 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.