Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. Why don't you try it and see?
  2. set_error_handler
  3. What's so complicated about it? Cut & paste the code from one of the CSS reset pages the Google search shows, and save it in an external CSS file. Link to it before linking to your custom CSS. Voila, you're all set. I mean, here's the link to Eric Meyer's reset file: http://meyerweb.com/eric/tools/css/reset/reset.css It can't get much easier than that.
  4. Okay. You can't call your function without passing it an argument (a value within the ()'s). Why? Because you defined it to always take one argument ($maint_on_off). So, you need to call it like so: maintenance_on_off("On"); //or maintenance_on_off("Off"); Also, remember that string values (e.g., text) must be encased in quotes, so you should always use quotes when invoking the function, and you should change your function body to: function maintenance_on_off($maint_on_off) { if ($maint_on_off == "On") { header("Location: ../maintenance.php"); } } In this case, it doesn't really matter if you use single or double quotes, so long as you actually use quotes of some sort.
  5. Have you looked into a CSS reset? Essentially, it's a stylesheet that zeroes out all styling on all elements, which would then allow your custom CSS to be (hypothetically) rendered in the same way across browsers.
  6. How are you trying to call your function?
  7. You need to do some basic debugging: 1. In your first example, are there any differences in the data between the values that are being inserted, and those that aren't? 2. Are you certain that the variables you pass into your queries have values? Your test worked because you manually wrote the values directly in the query. This leads me to believe your problem is that your variables aren't actually containing any values when you attempt to insert them, and the insert is failing because you have one or more columns that cannot contain a null value.
  8. 1. Are you declaring your user and player objects anywhere? 2. Can you show us your class code?
  9. I wouldn't store those files in a database at all. Simply upload them to a directory and use the db to keep track of their individual locations within that directory.
  10. Fixed code: <?php $result = mysql_query("SELECT * FROM computers"); ?> <html> <head></head> <body> <table cellpadding='2' cellspacing='2' border='1'> <?php while($row = mysql_fetch_assoc($result)) { echo "<tr><td>{$row['comp_id']}</td><td>{$row['comp_brand']}</td><td>{$row['comp_price']}</td></tr>"; } ?> </table> </body> </html>
  11. $num has a value of 10 within global scope. $GLOBALS is an array of all global scope variables. $GLOBALS['num'] is the same as accessing $num as though it was in scope. As always, check the manual if you're confused about a part of the language: globals With all that said, don't use the 'global' keyword or the $GLOBALS array. It leads to poor code.
  12. 1. If you're using Firefox, download and use the Firebug extension. It'll help you debug JavaScript. 2. Can you show more code? How is DoSave() being invoked? Where does the code lie in relation to your markup?
  13. There's a boolean you can set in mysql_connect that will force it to create a new, parallel connection to a db: mysql_connect However, I think it only applies if you're trying to attempt multiple connections to the same db. If the db's are actually different, then the db handle you create during mysql_connect should be enough. Can you show more code in how you're creating and using these connections?
  14. Why would an item in the submenu table even be in the main menu table?
  15. The language API is the full list. Anything else is from either jQuery UI or a jQuery plugin.
  16. Pass it to the function via the function's argument list? Example: function priceWithTax($price, $salesTax) { return $price + ($price * $salesTax); } $price = 5.00; $tax = 0.08; $finalPrice = priceWithTax($price, $tax);
  17. Really? Type 'jquery' as your Google search term. Click on the very first link you see (which is, unsurprisingly, jquery.com). Click on the link at the top that says 'Documentation.' Or: http://docs.jquery.com/Main_Page The jQuery API (Application Programming Interface) reference has all you need.
  18. Don't use global. It's a programming crutch that leads to easily avoidable errors. Learn how to do things the right way. PHP isn't all that different from other languages when it comes to variable scope and argument passing.
  19. You need: $array_to_print[] = "element7"; Within the body of your function.
  20. There's also the fact that it requires a plugin, that like other Adobe products (I'm looking at you, Acrobat Reader) it's a vector for malware, and a couple of the big smartphone manufacturers (Apple, Microsoft) want nothing to do with it. As a language, Actionscript is a proprietary and modified/extended version of JavaScript. Take that as you will.
  21. Try: <!DOCTYPE html> <html> <head></head> <body> <input id="dataInput" type="text" /> <button id="addData" type="button">Click to add data to the list below</button> <br /> <div id="display"></div> </body> <script type="text/javascript"> var oButton = document.getElementById('addData'); var data = document.getElementById('dataInput'); var display = document.getElementById('display'); oButton.onclick = function() { display.innerHTML += data.value + "<br />"; } </script> </html>
  22. Why? The user object should have properties that I can set, either directly or via getters and setters. When I call $user->save() it should internally do the following: 1) Perform a check that the current $user object is valid. All required fields are there. All formatting requirements are met. 2) Determine if this is a user that exists in the database. Doesn't exist? Insert. Exists and was loaded from the database? Update. Exists and we didn't expect it to? Throw an exception. Yeah, I wasn't really clear with what I meant. The 'creation' I referenced above was meant as the mechanism which obtains the registration form data, filters/validates it, then creates a User object from that data.
  23. Simply pass the outer variable to the object via a function: class Person { private $name; public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } } $test = "test" $person = new Person(); $person->setName($test); echo $person->getName(); Well said. Did you see this reply? LMAO, nope. That will teach me to jump directly to the last message or two in a thread.
  24. That's the correct result. $integer = $firstnumber = -0.025, which is less than 0. Your conditional tests whether or not it's greater than or equal to 0, which it is not.
  25. It was a big badger, too. About the size of a whale.
×
×
  • 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.