SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you call another PHP script with include(), can the include use the variables set in the parent document, or is there some sort of rigamoroll you have to go through to make that happen?

    Sorry, stupid question from a mostly ignorant novice. Ahh, but someday I'll be the one answering silly questions from semi-ignorant novices.
    Ed Rands

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The answer is yes.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now that's fast service -- under five minutes! Thanks for the help!
    Ed Rands

  4. #4
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no.. no need to!

    include () and require () are kinda like writing the script directly into the script you are includint them from.... and they have access to all of the variables that your main script has.

    Here's an example..

    PHP Code:
    // Include File
    // total_weight.inc
    function total_weight($weight$qty){
    echo(
    "$weight * $qty);

    [php]
    // Main file
    require "total_weight.inc";
    while($row = mysql_fetch_array($result)){
    $weight = $row['weight'];
    $qty = $row['qty'];
    total_weight($weight, $qty);
    }

    there... that show's how it works! As you can see... it's pretty simple!
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  5. #5
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Better than your tech support right
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •