...

View Full Version : DO keyword



ajetrumpet
12-17-2010, 09:05 PM
can someone tell me what the DO keyword does in query strings? for example:
search.php?do=processis that a different type of query than those querying info from a database?

thanks

Fou-Lu
12-17-2010, 10:40 PM
A querystring is a string, nothing more.
The GET is split into key/value pairs from x=y within a querystring. The only thing that do represents is that $_GET['do'] will equate to 'process', but nothing more. What is done with it is up to the developer.

In other words, 'do' within a query string does nothing.

ajetrumpet
12-18-2010, 07:38 AM
A querystring is a string, nothing more.
The GET is split into key/value pairs from x=y within a querystring. The only thing that do represents is that $_GET['do'] will equate to 'process', but nothing more. What is done with it is up to the developer.

In other words, 'do' within a query string does nothing.I thought it had some special meaning. almost like a function. It is widely used then as a variable, is that right?

what makes it so popular?

Inigoesdr
12-18-2010, 08:12 AM
what makes it so popular?

It's just personal preference. It's generally easier to explain to someone who is fairly new to coding how the process works if you can say "do=action". It's more like natural language, and therefore easier to pick up.

ajetrumpet
12-18-2010, 08:48 AM
It's just personal preference. It's generally easier to explain to someone who is fairly new to coding how the process works if you can say "do=action". It's more like natural language, and therefore easier to pick up.

can you give me a working example of "do=action"???

Fou-Lu
12-18-2010, 04:11 PM
function action()
{
print 'action!';
}

switch (@$_GET['do'])
{
case 'action':
action(); // or even just process, which I don't like to do in switches myself as it becomes harder to read with more complicated instructions
break;
}


The naming is irrelevant. You could call it myawesomevariable=process if you wanted to.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum