Jump to content

require file with variable?


goodban

Recommended Posts

I have a logbook that I created using php/mysql with the help of dreamweaver.  Everything was going fine until I wanted to add replies to the logbook.  I have tried everything I can, but I cannot get this "include" file to pull up the right data, or come up at all.  This is what I'm currently trying to do:

<?php require('replies.php?<?php echo $row_logbook_reverse_id['id']; ?>=id'); ?>

I just don't know where I'm going wrong.  I've tried to search for this on php.net but honestly, I don't know the proper term of what I'm actually trying to do. 

Link to comment
Share on other sites

php include/require statements, unless you specify the syntax for a url (protocol, domain, path, file - i.e. http://your_domain/your_path/your_file.php), operate on files through the file system, where url get parameters - ?some_name=some_value have no meaning.

 

however, you would in general not want to use a url, because it is slow (your web server makes a http request back to your own web server), you only get the OUTPUT from your file, not the actual php code, and the two php settings that are required for a url to work are turned off by default due to the security problem of this allowing unvalidated external values being used to specify included files to allow a hacker to include their remote code onto your server and run it on your server.

 

if your goal is to retrieve some information based on an id and make that information available to the 'calling' code, you would write a function that accepts the id as a parameter and returns the data to the calling program.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.