Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird Error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I was wondering if anyone knew what's wrong with the line of coding below:

include('bandreviews.php?band_id='.$band_id.'');

For some reason I seem to get the error below even though if i put that address "bandreviews.php?band_id=2" in my browser it works.:

Warning: Failed opening 'bandreviews.php?band_id=2' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/newfound/home/httpd/html/banddatabase2/reviewband2.php on line 39

I'd be greatful if you could help. Cheers
 
The include function tries to open the file with the name of the argument. So when you specify bandreviews.php?band_id='.$band_id.'' as the filename it would try and open a file named bandreviews.php?band_id=CONTENT OF $band_id.
This is wrong. You cannot pass GET arguments with the include function, at least not the way you want. The bandreviews.php file would have access to all the variables that are available in the script calling the include function, as the contents of the file are _included_ in the script before it's executed.
All you really need is this:
Code:
include('bandreview.php');
When you use $band_id in the bandreview.php script, it would have the same value as the script that used the include function has. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top