![]() |
view.php?=4aFA3a
Alright so I am working on a project (still/again) and I am stuck here again.. It is sort of like pagination but not exactly.
I want to allow the user to go to the url with a string, the string is then checked in the mysql database if it exists it pulls data from the database of the row with that info, and then have the information in the database displayed to the user on that page. Cheers, Randy |
Where in your code are you getting stuck?
|
I am unsure about how to create the url and then how to get the code from that url.
|
This page would be a good starting point for reviewing the material you need to understand for this type of situation. In particular read the section immediately following Example #2.
Just to summarize, your query string is based on key->value pairs, and is considered a GET request. PHP automatically stores all values it finds in either a POST or GET request in similarily named superglobals, such as in your case $_GET. To apply a GET query string, you're going append a question mark, followed by the key->value pairs, such as http://mydomain.com/mypage.php?key=value&this=that (multiple key->value pairs are appended with an ampersand). From within PHP you can access these with $_GET['key'], which would for the previous example return 'value', or $_GET['this'] would return 'that'. From there, your options are wide open to interpret the values and act upon them. |
That looks like it will work for getting the data but then how do i create that url.
I am unsure how to create the url: http://mydomain.com/view.php?view=3fa5D |
Well I can't code the whole thing for you, so you're going to have to help us by explaining the sequence of events that you're planning for, and what you've accomplished so far codewise.
|
Surely it's just a case of creating a random string using the relevant function, and then quickly checking if that string exists in the database. If it does the random function runs again and checks. If it doesn't already exist in the database then you have your random string to insert into for that record?
|
Hey
You've probably solved this by now, but anybody else looking for the solution, just thought I'd post what I'd do.. Code:
<?php |
| All times are GMT. The time now is 02:58 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0