a basic thing to know....

Reply

Join Date: Jul 2009
Posts: 23
Reputation: nostalgia149 is an unknown quantity at this point 
Solved Threads: 0
nostalgia149 nostalgia149 is offline Offline
Newbie Poster

a basic thing to know....

 
0
  #1
Jul 18th, 2009
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..........
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 12
Reputation: innocent.boys is an unknown quantity at this point 
Solved Threads: 1
innocent.boys innocent.boys is offline Offline
Newbie Poster

Re: a basic thing to know....

 
0
  #2
Jul 18th, 2009
more elaborate your Ques with an example..???
are you talking about Id which u get from database...???
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 23
Reputation: nostalgia149 is an unknown quantity at this point 
Solved Threads: 0
nostalgia149 nostalgia149 is offline Offline
Newbie Poster

Re: a basic thing to know....

 
0
  #3
Jul 18th, 2009
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>
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 464
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: a basic thing to know....

 
0
  #4
Jul 18th, 2009
nostalgia149,
It's called query string. It is used to pass some information/data between page request.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 960
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 126
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

Re: a basic thing to know....

 
0
  #5
Jul 18th, 2009
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.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 464
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: a basic thing to know....

 
0
  #6
Jul 18th, 2009
You may use $_REQUEST for the same.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 23
Reputation: nostalgia149 is an unknown quantity at this point 
Solved Threads: 0
nostalgia149 nostalgia149 is offline Offline
Newbie Poster

Re: a basic thing to know....

 
0
  #7
Jul 23rd, 2009
Originally Posted by ardav View Post
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?????????????????
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 23
Reputation: nostalgia149 is an unknown quantity at this point 
Solved Threads: 0
nostalgia149 nostalgia149 is offline Offline
Newbie Poster

Re: a basic thing to know....

 
0
  #8
Jul 23rd, 2009
Originally Posted by adatapost View Post
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??????????????/
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 960
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 126
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

Re: a basic thing to know....

 
0
  #9
Jul 23rd, 2009
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:

  1. http://www.example.com/delete.php?id=12389&confirmcode=hy6io98

You could equally have used:

  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.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 148
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: a basic thing to know....

 
0
  #10
Jul 23rd, 2009
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.
If you're question/problem is solved don't forget to mark the thread as Solved!

-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC