Working with Database PHP MYSQL Wampstack Data Show on Bootstrap Table
Working with wampstack:
First of all download bitnami wampstack from this link,
https://bitnami.com/stack/wampInstall the wampstack. Keep in mind when installing it will ask to set a username and password. It easier to keep user name as root and choose password that is easy to remember.
After installation is done next task is set wamp mysql to path. Go to,
System Properties -> Advanced System Settings -> Environment Variables -> System Variables -> Path
Add a semicolon after whatever is already there and paste, "C:\Bitnami\wampstack-5.6.26-2\mysql\bin". Do not put a semicolon after it. Alternatively go to (version may differ),
C:\Bitnami\wampstack-5.6.26-2\mysql\bin
Now that path is set it is possible to open command line and log in to mysql. In order to do it use the following,
mysql -u root -p
Remember to set the path or do the alternative option. Now it will ask for password. Use the password that was given for phpmyadmin during bitnami installation.
Now create a database using,
CREATE DATABASE cse
It could also be done from phpmyadmin. Now next task is to open phpmyadmin by going to "localhost/phpmyadmin" on web browser. Notice a new database called cse on the left.
That was just an example of terminal. Next task is to create tables. Open sql tab again and paste the code below and press go.
Next task is to get some data into database. Download the data given here,
http://codex.cs.yale.edu/avi/db-book/db6/lab-dir/sample_tables-dir/smallRelations/smallRelationsInsertFile.sqlNow go to import tab on phpmyadmin and select the smallRelationsInsertFile.sql file and press go. Now all the data will be inserted into cse database. These data can now be shown using php.
Go to "C:\Bitnami\wampstack-5.6.26-2\apache2\htdocs" and create a new folder named project where all files will be kept. Create a new php file there and name it "sample.php".
Code sample.php:
Final Result:
If everything above was done correctly the following will be shown. In order type the url in browser,localhost/project/sample.php
Comments