PHP scripts?

This Question From PHP Scripts | 4 Answers


QUESTION:

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?

4 Comments so far

  1. Tracy L on June 1, 2010 2:10 am

    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.

  2. noelle1211 on June 1, 2010 2:33 am

    Dreamweaver makes all of that really easy.

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

  3. Zeo on June 1, 2010 3:03 am

    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!

  4. merlot7799 on June 1, 2010 3:23 am

    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:

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

    This will print septembersmith24.

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

    < ?php
    $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.




Powered by Yahoo! Answers


Licenced Practical Nursing Programs - Support WordPress
You can syndicate both the entries using RSS Feeds and the Comments Feed