#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Washington, DC
    Posts
    40
    Rep Power
    13

    Getting live feeds for websites and Javascript within PHP


    Hello all,

    My first time using this forum, so if I'm makin a mistake, I apologize beforehand.

    I have two questions:

    1) I am trying to get some entertainment news feeds for my website and was wondering if there is a way to do this, or where I can learn more about it. They don't have to be live, just so that they get stored in a DB so I don't have to search for them everyday.

    2) Is there a way to use PHP within JavaScript, or vice-versa. This I am trying to do so I can use MySQL functions in JavaScript. I am trying to validate a form and instead of throwing it to another page, I am calling a function on the same page, and if everything is ok on the form, send to another page.

    Thank you,
    Rockit
    Dreams don't come with expiration dates.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    191
    first of all: php is server-side, javascript is client-side.
    they can be combined, but the problem is:
    your page needs to load another page to start a php-script

    you can do:
    Code:
    document.write('<img src="myphpscript.php?params=....">') // to trigger execution of a php script
    and
    Code:
    <script language="JavaScript">
    <? echo "var myVar1='".$myValue1."';\n"; ?>
    </script>
    to use both.

    to avoid users noticing that you actually reload a page, you can use frames.

    you can use both together to setup a page that dynamically updates using javascript to get content from a php script.

IMN logo majestic logo threadwatch logo seochat tools logo