Jump to content

Recommended Posts

hey @requinix, I know you and I have talked about this before but I just want to clarify this issue.  Sadly, I have produced very few websites that have made use of dynamics in the form of database querying.  But, the next project that I'm looking at will require it.  The last thing I did with a query string involved the recording of downloads of file on a website.  and on the page, I had this code:

The archive is located here:   <a href="dl.php?f=archive.zip">archive.zip</a>

and the ''dl'' page had this code:

if(!$_GET['f']) error('Missing parameter!');

        $stmt = $conn->prepare("INSERT INTO tblDownloads (ip, file, date, time) 
        VALUES (?, ?, ?, ?)");
        $stmt->bind_param("ssss", $ip, $file, $date, $time);
        $stmt->execute();
        $stmt->close();
        $conn->close();
	
	    header("Location: archive.zip");
	    exit;

and all the variables in the above ''dl'' page are declared in a file that is required by it, called ""conn.php"".

My question for anyone here is:

I am going to be producing a website similar to the testing site called ""jsFiddle"":  https://jsfiddle.net/ .  And it is slated to have a huge amount of content on it.  for example, a main page might have 100 links on it whereby, if a user clicks on any of them, it should take them to another page (or load async content) that illustrates and example of any given issue being asked about.  So, I know we've talked about $_GET before Requinix, and how most websites use it to produce dynamic content.  And we've also talked about the concept of markdown.  But once again, can someone here remind me....what's the best way to go about doing this?  Storing the actual ""answer to the issue"" content in a backend database and pulling/displaying it appropriately, kind of like what I am showing I did with the file in the above code?  thanks.

Adam

Edited by ajetrumpet
Link to comment
https://forums.phpfreaks.com/topic/311438-universal-query-string-for-every-page/
Share on other sites

You'll have a database table that contains, at a minimum, (1) some identifier, (2) content, and apparently (3) some "answer to the issue". Right?
Link to the page using the identifier, which could (and probably should) be a rewritten URL, then use the identifier to pull the content and whatever.

I'm not really sure why there's a question here.

14 hours ago, requinix said:

I'm not really sure why there's a question here.

probably because I'm a hesitant moron who, for some reason, doesn't just ""jump in and do it"".  and you've answered the question just fine.  thanks much.  enjoy your day, Mr. Administrator.  😃

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.