My first PHP program: Odds ratio and Cox index calculator

Finally ... at the age of 50 (!) ...  I was able to write my first PHP program.


Based on the results of logistic regression model (the intercept and the program impact estimate -- all expressed in logit), this program allows a user to calculate an odds ratio statistic and a standardized effect size (Cox index).  The algorithm can be found in What Works Clearinghouse's standard document:

WWC procedures handbook (see page. 14)
WWC standards slides (Definition of small sample size correction, slide 14)

I replied on the following materials:

Udemy, Reece Kenny's Create a REAL Social Network like Facebook in PHP + MySQL.  Honestly I didn't complete this course, but I learned how to run PHP and MySQL on my PC by installing XAMPP and running files from the XAMPP's subfolder (C:\xampp\htdocs).  I also would have never figured out how to look at results by opening the file from localhost (e.g., http://localhost/calc.php).

Michiko's code.  I first copied her simple calculator example and modified it to make my program.


Not seeing a MySQL table I just created

I created a new blank MySQL database.  I couldn't see it when accessing it via. phpMyAdmin.   I only saw two old MySQL databases.

It turns out that the new one was associated with a different user name.   I had to log out of the screen first by clicking on one of the icons on the left-upper side of the phpMyAdmin window.   After the log-out, I logged in with the right user name and the password, when I was able to see all MySQL databases I needed to see.

Each phpMyAdmin session is specific to each of the users I created.

PHP if statement

if ($money > $taxIncludedPrice) {
echo 'You can buy this item';
} elseif ($money == $taxIncludedPrice) {
echo 'You can buy this item, but you will not have any money left';
} else {
echo 'You cannot buy this item';

How to run PHP, MYSQL, etc. on Windows

To run PHP and MySQL on your own PC, download and install WAMP.  Find the program at:

(Upon installation, it didn't give me any annoying malaware programs, so I'm glad.)

The video at the following URL shows you how to run PHP on Windows after installing Wamp.  You write a php file (e.g., kaz.php), place it in C:\wamp\www , and open it with a browser by typing, for example, localhost/kaz.php in the URL window.  The browser will show the result.  In my case, clicking on the file itself does not provide the correct result.