943,691 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 809
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 18th, 2009
0

a basic thing to know....

Expand Post »
is it good to ask whats the use of id while working with php.... if u talk abt property . whose property is it.. the link of the present web page or that of the destination page that the codes makes the page to get redirected..........
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nostalgia149 is offline Offline
23 posts
since Jul 2009
Jul 18th, 2009
0

Re: a basic thing to know....

more elaborate your Ques with an example..???
are you talking about Id which u get from database...???
Reputation Points: 11
Solved Threads: 1
Newbie Poster
innocent.boys is offline Offline
12 posts
since Jul 2009
Jul 18th, 2009
0

Re: a basic thing to know....

hiiiiiiiiiiii................. i m talking abt the id which is associated with the page of the present web page....................like...........
<a href="edit_page.php?id=<?php echo $tyu; ?>">MAKE CHANGES IN THE RECORD</a>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nostalgia149 is offline Offline
23 posts
since Jul 2009
Jul 18th, 2009
0

Re: a basic thing to know....

nostalgia149,
It's called query string. It is used to pass some information/data between page request.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jul 18th, 2009
0

Re: a basic thing to know....

The id to which you refer can mean ANYTHING. Using 'id' in the querystring is just force of habit for most programmers when you want to pass a variable such as member id, page id etc. In these instances, the 'id' is often used for data retrieval from a database or a file. A common usage for this would be to get a record or records from a database table which has a field that has that particular id value.

pHp uses the $_GET variable, in this instance the $_GET['id'] variable, to pass on the data from one page to another as mentioned by adatapost.

Good question.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 945
Sarcastic Poster
ardav is offline Offline
6,673 posts
since Oct 2006
Jul 18th, 2009
0

Re: a basic thing to know....

You may use $_REQUEST for the same.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jul 23rd, 2009
0

Re: a basic thing to know....

Click to Expand / Collapse  Quote originally posted by ardav ...
The id to which you refer can mean ANYTHING. Using 'id' in the querystring is just force of habit for most programmers when you want to pass a variable such as member id, page id etc. In these instances, the 'id' is often used for data retrieval from a database or a file. A common usage for this would be to get a record or records from a database table which has a field that has that particular id value.

pHp uses the $_GET variable, in this instance the $_GET['id'] variable, to pass on the data from one page to another as mentioned by adatapost.

Good question.
thanks ardav... so id is mainly for linking two pages using a common entity .. is it???????? where else is it useful apart frm this n common applications?????????????????
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nostalgia149 is offline Offline
23 posts
since Jul 2009
Jul 23rd, 2009
0

Re: a basic thing to know....

Click to Expand / Collapse  Quote originally posted by adatapost ...
You may use $_REQUEST for the same.
hi.. adatapost... with the little understanding of php wht i hav understood is that.. we use request whn v use certain data frm the same page and use the database.. in case of post v use it whn v hav to get the data frm a different page.. forget get for the time being.... how far is my conception right??????????????/
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nostalgia149 is offline Offline
23 posts
since Jul 2009
Jul 23rd, 2009
-1

Re: a basic thing to know....

The 'id' to which you refer, is meaningless. It's just a name (or 'key') in a querystring (the bit at the end of the url following '?') to which you can assign a value, which can be almost anything.

e.g. If this is your website and you wanted to send info to a page to delete an user:

PHP Syntax (Toggle Plain Text)
  1. http://www.example.com/delete.php?id=12389&confirmcode=hy6io98

You could equally have used:

PHP Syntax (Toggle Plain Text)
  1. http://www.example.com/delete.php?user=12389&confirm=hy6io98

You would then, in this instance use $_GET['user'] in your delete.php file to get at the data (12389) as opposed to using $_GET['id'] in the first example.

$_GET can also be used with forms if you set the 'method' attribute to 'get'. I would advise against this, use 'post' if possible.

adatapost may get back to you about $_REQUEST, so I won't step on his toes by giving an explanation.

So the querystring (rather than calling it the 'id'), is a way of passing data to the page in question.

BTW: you wouldn't necessarily delete an user through a querystring, there are more secure ways of doing this.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 945
Sarcastic Poster
ardav is offline Offline
6,673 posts
since Oct 2006
Jul 23rd, 2009
0

Re: a basic thing to know....

Just be very careful when working with values passed in the GET & POST arrays . Its extremely easy for them to be modified by the user and you have to be fully aware of this.

Probably the most common thing i've seen is the usage of $_GET and $_POST in queries or being used to dynamically include files in their raw, straight from the url, forms.
Sponsor
Reputation Points: 265
Solved Threads: 126
Practically a Master Poster
mschroeder is offline Offline
624 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Need a browser based game developer or team of developers
Next Thread in PHP Forum Timeline: Retrive data





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC