By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,827 Members | 813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,827 IT Pros & Developers. It's quick & easy.

how to attach together with the query in include

P: 65

I will like to know how to i attach together with the query in the include..


Expand|Select|Wrap|Line Numbers
  1. include "main.php";
but if i attach together with the query, it is cant work..

Expand|Select|Wrap|Line Numbers
  1. include "main.php?id=$infoid";
Can someone guide me..??
Oct 29 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 5,058
Hi Wish.

The GET protocol is a HTTP Protocol, which is only available in HTTP Requests.

The include() function is used to load code from a local resource. So if you ask for 'file.php?var=hello' it will look for a file called exactly that rather than 'file.php'.

Note that the include() function will load the code from the file into the current script so if you need to import a variable into that code you could do something like this:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   echo $myVar;
  3. ?>
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $myVar = "Hello World!";
  3. include("inc.php");
  4. ?>
Will print 'Hello World!".
Oct 29 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.