English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories
0

I often see webpages with a .php?something
How can I write a script so that whatever "something" is can be accessed by the script? Is there also a way to access an external dat or txt file with a php script?

2007-09-22 02:37:42 · 5 answers · asked by relientkfan153 1 in Computers & Internet Programming & Design

5 answers

The "something" can be accessed very easily with PHP. If you have a web page address that looks like this:

index.php? month=september&name=smith&age=24

Then you can access those values in PHP like this:

echo $_GET('month');
echo $_GET('name');
echo $_GET('age');
?>

This will print septembersmith24.

As for accessing a text file, that's easy too:

$text = file_get_contents( 'textfile.txt' );
echo $text;
?>

This will read the entire contents of the file textfile.txt into the variable $text, and then print it out for you.

You can also access many databases with PHP, I highly recommend you use MySQL. It's a bit too complicated to describe here, though. There are some good references made to good books by folks above. The "Teach Yourself" series is great.

2007-09-22 12:51:19 · answer #1 · answered by merlot7799 3 · 0 0

Yes, PHP is an active script, very often used with MySql for full database access! You can use flat file databases or text files also. It is a very good and very powerful tool.

See http://php.net for more details
You can also find all sorts of "pre-done" scripts at
http://php.resourceindex.com/

I would tell you to pick up a copy of Teach yourself PHP MySql and Apache in 24 hours.
http://www.amazon.com/Teach-Yourself-MySQL-Apache-Hours/dp/067232489X
or your local book store.
Great book with a CD that has really great re-usable scripts
The "something" are calls made to data items following the ? are parameters that are passed by the PHP code to other pages. Just like here on Yahoo where you see
/index?qid=20070922063742AA0dhxZ&r=w&pa
Most scripting languages use that system for parameter passing.

2007-09-22 02:47:29 · answer #2 · answered by Tracy L 7 · 0 0

PHP will allow you to read and write from many sources, such as a text file, an image, or a database system. PHP should be able to read and write most file types provided that it has the support and libraries for it that allows you to have control over it. PHP does NOT mean you have to use a database system. Programming in PHP does not require you to have a fancy editor; you can even use Notepad. Go to http://www.php.net/manual/en/ and start learning!

2007-09-22 03:20:37 · answer #3 · answered by Zeo 4 · 0 0

Dreamweaver makes all of that really easy.

.php file means you would have to set up a database.

2007-09-22 02:58:10 · answer #4 · answered by Anonymous · 0 1

specific, the consumers might desire to have get get admission to to permissions on the database. you will desire to alter that at as directly as with the database making use of sq. or with some gadget like phpMySQLAdmin. Do a google on "mysql consumers permissions" or easily study the documentation on the MySQL information superhighway web site. they make sparkling it particularly of course. i want that what you attempt to do and that my clarification made journey. I wasn't specific if *you* have been having get get admission to to matters or your distinctive consumers. easily placed, each physique who connects to the database has to have permissions to do some thing, and those permissions are saved interior the database itself. many times, each physique can study and question, yet you will desire to set distinctive permissions for writing, updating, deleting, etc.

2016-10-09 15:43:01 · answer #5 · answered by ? 4 · 0 0

fedest.com, questions and answers