Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. It should be noted that directly accessing object properties is a Bad Idea. You should implement accessor functions instead.
  2. A couple of things: 1. $(document).ready() should be used at the beginning of your JavaScript code, and not within a function. I'm not sure you even need to use it, in this instance, given what you're trying to do. 2. Look at your code closely. Your function attempts to add an event handler function to the click event of an element with an id of myButton. You don't have such an element. Your function should simply look like: function ItemSelected(file) { alert(file); $("#message-paragraph").load(file); }
  3. Hehe, no problem. I've done the same thing many times myself.
  4. Have you tried changing the sendmail.php code to: $_POST['Email'] ?? I ask, because the name component of the name-value pairs you send via the poststr variable all have their first letters as uppercase.
  5. to sendform.php Set, not sent . Where/how is the poststr variable actually being assigned to?
  6. Hmm...where is poststr being set?
  7. KevinM1

    AI

    FYI, most AI research is done in Lisp, which can be used as a scripting language if you want to. I wouldn't want to, though. Also, Lisp is a hell of a lot more efficient than PHP. Running something as a script always incurs the cost of accessing the interpreter. Given the OP's requirements/ideas of AI, I'd want my program(s) to run directly on the hardware.
  8. One line of code isn't enough to diagnose the problem.
  9. KevinM1

    AI

    Also, if you want to get into AI, PHP isn't the way to go. Not because of its function list, but because of what PHP is. It's an interpreted scripting language. Meaning, code is read and executed in the exact way it's written - top-down, till the bottom of the page. Because it's interpreted, it's slow. It's good enough for web apps, but for something that requires real speed it's definitely not the way to go. And then there's the inability to access dynamic memory.... No, if you're interested in AI, you'll need a compiled language, like C/C++.
  10. Let me guess... your 'str' value comes from some form field or query string, right? If so, it's being treated as a string and not a number. To fix it, run it through the parseInt() function: function showUser(str) { str = parseInt(str); if(str == 5) { string = "Name: Harold<br>Location: Montreal, Canada"; document.getElementById('txtHint').innerHTML = string; } else { alert("Wrong ID, Please try again"); } }
  11. Yeah, that's an example of one of the benefits. The example I read (which was lame, but still illustrated the point) was say you're 'survivor' type show is on in a few hours, and you live on the west coast.. in theory, nothing stops you from checking the results of who got ousted on Twitter before the show is on in your time zone. People can post results on Twitter once they see the show (and assume they are a few time zones a head of you). While popular websites are updated with half decent speed, I don't think it compares to Twitter in that regard. Like you say, that's a lame example because the same could be said for any message board or wiki. The hook for Twitter is that it's essentially a RSS aggrigator (sp?), only the feeds are other people that you subscribe to. It's pretty much the same thing as Facebook's status update feature, without the stupid 160 character limit. I haven't played around with it much myself, so I'm wondering how the updates are displayed. If there's some real time AJAX-driven mojo that automatically makes the updates appear on the screen after each submission or comment, it'd be perfect for the revolutionary on the run.
  12. FWIW, Twitter posts have been describing the situation in Iran with greater frequency and more accuracy than any American MSM source. Things that have later been verified by photos, videos, and reporters hours later.
  13. It's a syntax error. You simply need: if(!isset($val)) { /* code */ } The '!' is a logical NOT, so the expression literally says "If $val IS NOT set, execute the following code." EDIT: Remember also that checking to see if a value is set is NOT the same as checking whether it's value is false.
  14. Is the text stored with a tab in the db? Also, are there any attributes set in your textarea element?
  15. Unfortunately, baffling error messages are what IE is known for. Double unfortunately, I didn't get any errors in FF, so I can't use Firebug to point me in the direction of where your error lies. I'm guessing, since the error is being reported right at the beginning of the document, that either it's choking on some library/framework code, or one of the initial lines of your code. Specifically, I'd look to see if the Mootools addEvent function is behaving properly. You should also double-check that your various bits of library code can co-exist with one another. There's a chance that there's a pesky interoperability issue that IE can't resolve. If the problem persists, the only thing I can suggest is to create a fresh page as a test bed. Add each external .js file to it and test it before moving to the next. As you slowly rebuild your code in that test page, you should be able to detect when the error pops back up, which should (hopefully) give you an idea of what the culprit is.
  16. Sorry...I thought your problem was with $site. And, ted's right with your variable assignment problems. As an aside, rather than pass the db table name as an encoded query string, why not pass it is a hidden form field? That will remove the need to encode/decode it, as well as stop it from being immediately visible (and editable) in the user's address bar.
  17. http://www.php.net/manual/en/function.mysql-real-escape-string.php
  18. You're actually on the right track. Remember that functions can take arguments and return values. So, you can pass in your error_msg array to the validation functions and add an error message, if need be. This will allow you to also forgo using the dreaded 'global' keyword, which should be avoided where possible. So, you have your error_msg array... $error_msg = array(); Now you need to pass it to your validation functions. You'll need to pass it by reference (don't worry if you don't understand that) to ensure that any changes made by the functions persist outside of them. So... function check_names(&$error_msg) { /* pre-existing name validation code goes here */ } function check_email(&$error_msg) { /* pre-existing email validation code goes here */ } function show_receipt($pizza) { /* pre-existing receipt code - WITHOUT 'global $pizza' - goes here */ } function show_form($error_msg, $array_pizza, $array_toppings, $data) { /* pre-existing form code - WITHOUT any of the globals - goes here */ } Let me know if this helps.
  19. Hehe EDIT: I admit, though, that the wording to that initial "it ain't gonna work" response was a bit awkward...even I went "what the hell was I trying to say?" when I re-read it.
  20. He'd also need to write a new method, or edit an existing one, to actually do something useful with his new $rank property.
  21. Remove the line starting with //
  22. Okay, I see it...it was buried under mounds of over-commented code. Here's the thing - you can't pass a value to an object and automatically expect it to work. The class that the object is an instance of needs to be written in such a way that it can handle your cookie data. Right now nothing is happening because, from what I can see, the calender knows nothing about 'rank' or anything else of that nature.
  23. What exactly are you trying to do with the cookie info? Are you trying to pass it to the calender object? If so, what are you hoping to accomplish?
  24. You don't have to use <?= $fileurl; ?> Since you're already within a PHP code block. You also need to encase any array value you want to be parsed within a string (in this case, $row['article_title']) in curly braces. So, with all that said, simply use: $url = $row['article_url'] . "-" . $row['article_id'] . ".html"; echo "<a href='$url'>{$row['article_title']}</a>";
  25. You need to provide more information. What does your class look like? Is it instantiated? What about the main code, where you're trying to use the cookie?
×
×
  • 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.