You are here: Re: Parameters in PHP « PHP Programming Language « IT news, forums, messages
Re: Parameters in PHP

Posted by Shelly on 10/23/07 16:07

"Jeff Gaines" <jgaines_newsid@yahoo.co.uk> wrote in message
news:xn0fcsm06378v50002@news.individual.net...
>I have down-loaded several php scripts and am working my way through them
>as part of my learning process. I have noticed situations like this:
>
> mysql_query("DELETE FROM $table WHERE id=$id",$db);
>
> where scripts have been called from another script/page with a parameter -
> i.e. 'id' is a parameter that is not defined in the script before the
> above line is called.
>
> They don't work as they are but I can get the parameters by using
> $_GET['id'] or sometimes $_POST['id'].
>
> Is this a result of different versions of php (I am using v5) where
> behaviour has changed or is it something else that is going completely
> over my head because I am so new to this?
>
> Many thanks.

Yes, it is because you are so new to this.

The $id is a variable called $id and contains the value you want for the id.
How you get it can be from any of the ways that you set a value for a
variable in php. These include the get, post, or simply setting it to
something or calculating it from something. It is totally independent of
the mysql call (and has to have been set first).

The $db is the variable that contains the connection to the database
obtained from a mysql_connect or a mysql_pconnect call.

These are in php4 and, I assume, from the earliest versions of php (I was
not doing php at that time).

Look at www.w3schools.com for a good tutorial on php (and many other
things). Also, look at www.php.net for just about everything you need in
php.

Good luck and we are here to help you get off the ground.

Shelly

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация