Saving Javascript Using PHP/MYSQL

Discussion in 'Web Design and Development' started by pierce111, Sep 11, 2008.

  1. pierce111 macrumors newbie

    Joined:
    Aug 2, 2008
    #1
    Hi everyone. I have been looking into how to save Javascript using PHP, but I have not been able to find any helpful answers. If anyone could show me how to save Javascript with either PHP or MYSQL, that would be great!
     
  2. bootedbear macrumors 6502

    bootedbear

    Joined:
    Sep 13, 2004
    Location:
    Austin, TX
    #2
    You might need to explain what you mean by "saving JavaScript".
     
  3. pierce111 thread starter macrumors newbie

    Joined:
    Aug 2, 2008
    #3
    By "saving JavaScript", I mean taking the information that Javascript has put on the page (including forms) and save it to a MYSQL database (with PHP). If anyone needs any more clarification, feel free to ask!
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    Well if the page has a form you can simply submit to a PHP script that will then save whatever you have in the form. You could also use AJAX to connect to a PHP script, which will store things in a database. There's an enormous amount of tutorials out there, just search for them.
     
  5. pierce111 thread starter macrumors newbie

    Joined:
    Aug 2, 2008
    #5
    Hi. :) I probably should have specified more... I want to connect to PHP at intervals (or changes to the current text). However, I can't find any documentation for that...
     
  6. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    Yea, AJAX is what you want. AJAX can call PHP whenever you need, even automatically. See this Periodic Refresh AJAX Pattern for some details. Essentially you'll use JavaScript's setTimeout or setInterval functions to call some function every so many seconds.
     
  7. pierce111 thread starter macrumors newbie

    Joined:
    Aug 2, 2008
    #7
    Thanks for your reply, and the link. Unfortunately, I am fairly new to Javascript, and completely new to AJAX... So most parts of the page don't make much sense to me. Do you think I would be better off researching the setTimeout or setInterval functions instead?
     
  8. Me1000 macrumors 68000

    Me1000

    Joined:
    Jul 15, 2006
    #8
    While probably not the best thing to do at the moment, you can always try using a framework. jQuery is pretty simple to execute AJAX calls with, however it might be overkill.
     
  9. ChicoWeb macrumors 65816

    ChicoWeb

    Joined:
    Aug 16, 2004
    Location:
    California
    #9
    And the confusing thread of the month goes too.......
     
  10. Trip.Tucker Guest

    Joined:
    Mar 13, 2008
    #10
    Agreed. Complete mess of random guesses thrown willy-nilly.

    If the OP can describe what he/she wants to achieve without using any technology specifics, we may be able to help.
     
  11. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #11
    What you're wanting to do sounds to be over your head for the moment. Though if you have an existing PHP script that works, then using a JavaScript framework (as suggested by another person) would let you do AJAX without much knowledge. The setTimeout and setInterval are pretty easy functions to learn. I won't suggest any JavaScript frameworks as I don't use any myself. There's plenty of tutorials out there though for using them to do AJAX and should be easy enough to set it up with your PHP script, if that's done.

    If you're going to want specific solutions and help though, you'll have to add much more detail in your post. Good luck.
     

Share This Page