PHP is a server side scripting language. When someone types a URL into their browser, it is making a request to a server. If the request is for a PHP page and everything is working the way it should, the server will run the script and send the result back to the browser that requested it.
PHP might look something like this:
// This will demonstrate a loop which prints the value of $i on each line
$var = 5;
for($i = 0; $i <= $var; $i++){
print 'On this iteration, the value of $i is: ' . $i . "\n
";
}
?>
Using HTML, you can create a forms, buttons, check boxes, etc. to allow people to submit information to a PHP page which can use that information to perform calculations, retrieve data, change archives, request data from other websites, etc.
ie:
The thing to keep in mind about a server side scripting language is that all the code you write will be executed on the server. The user who requested the page will only see the output of a script.
When people want to store information in a database using PHP they're frequently using MySQL, which is a database management system which can allow people view and edit information stored in database using MySQL specific instructions.
ie:
select * from users where "first_name"="John" and "last_name"="Doe";
It's relatively simple to write PHP code to use MySQL, but if you're going to write your code from scratch you'll have to learn both.
Keep in mind that building out a full stock market application from scratch is a lot of work. You will need to make user accounts and keep track of stock prices, bids; perhaps you will even want to make detailed reports of your stocks in which case you'll have to make an application to manage that as well. All of these things will probably require you to build a sort of web interface so that people can edit their own data and it's easier for you to edit data regarding the stock market. There are ways to get around that necessity but you'd probably be writing a script that you would run once and then change later when you need to make the same kind of update to different information which can be quite a pain.
But if you're determined http://w3schools.com/ is a good place start learning about PHP and MySQL.
If you want something that has a lot of this code already built out for you, you might consider a content management system (CMS). A CMS provides you will web interfaces you might otherwise have to build out yourself. You can install commerce plug-ins, modules, extensions and the like. A CMS is a lot more complex than the application you would write by yourself because it has to be written in a way that makes the system flexible and modular. Various database tables will be used to keep track of module settings, display information to edit modules, display information to the end user, etc. You don't have to know very complex details about PHP and MySQL in order to use these systems, but you should get a good cursory knowledge of it, and how a CMS works.
Some major CMS platforms around right now are Joomla, Wordpress and Drupal. If you need help selecting a CMS, try checking out http://cmshelp.me/