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

    Join Date
    Feb 2002
    Washington, DC
    Rep Power

    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,
    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
    Back in the real world.
    Rep Power
    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:
    document.write('<img src="myphpscript.php?params=....">') // to trigger execution of a php script
    <script language="JavaScript">
    <? echo "var myVar1='".$myValue1."';\n"; ?>
    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