Question
I want solution by wampserver
4. Database Programming [8 Marks) a. Create a database in wampserver with your National ID. b. Create the table structure wit
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) Assuming that you had already installed wamp server and opened it. In, wamp server there is 3 services named as "php", "apache", "mysql". for time being, i am creating database in "phpmyadmin", steps are discribed below:

1) first of all, u have to complete login session containing "username" and "password" when you open phpmyadmin service in wamp server software.

2) after login, at left hand side there is "database" option, click on it, name it and press "create" . by doing this, database created, to add user to it follow below steps.

3) now, add user to database. click on "privileges". initially, privileges contains a local host id for the user but if the user want to add new user, then press on "add user account". after that, fill the details containing "USER name",  "Host name", "Password" and many more.

4) then check on the option "grant all privileged to database "database_name" ".

5) at last click on "GO".

b) first create database then to create table in that respective database in the phpmyadmin service of wamp server. follow the below steps.

1) Right click on the "database" in which we are required to create tables with necessary details. after clicking that, page is displayed in which user have to fill "name" of the table and "no of columns" of the tables and click on "go".

2) on next screen, user have to fill name of the column, type, length and many more. after filling one column details, click on "save". now to add further columns, use below information.

3) then on left side, you see the list of the databases. right click on the database where your table was created. then, you see list of available tables in that database. right click on your table name.

4) then, a screen is displayed containing "add" (enter no of columns), check on column(s) option, check on at the begining/ at the end, then fill "after info"(aftre which column you need to add column) by drop down then click "Go". then a screen is displayed where you have to fill column name, type, and more details.

5) click on save.

c) there are three types of methods in PHP to connect mySQL database i.e. MYSQL, MYSQLI and PDO. now to connect the php with the mysql database is defined below:

1) you have to follow below program:

  1. <?php
  2. function OpenCon()
  3. { // set variables
  4. $dbhost = "localhost"; // database host
  5. $dbuser = "root"; // database user id
  6. $dbpass = "1234"; // database user password
  7. $db = "example"; // database name
  8. //create connection
  9. $conn = new mysqli($dbhost, $dbuser, $dbpass,$db) or die("Connect failed: %s\n". $conn -> error);
  10. return $conn;
  11. }
  12. function CloseCon($conn)
  13. {
  14. $conn -> close();
  15. }
  16. ?>

2) to check the whether the connection correct or not, below is the demo code: after below code succes, we can modify the database in which we wish to make changes

  1. <?php
  2. //check connection
  3. include 'db_connection.php';
  4. $conn = OpenCon();
  5. echo "Connected Successfully";
  6. CloseCon($conn);
  7. ?>

d) to add data in tabluar format after adding data in database, we can use php and sql connection. it means that using php connection fill data in sql tables. follow below code:

<? php

// set variables from above code

// create connection as mentioned above

// check connection as mentioned above

//insert data

$insertRecordQuery = "INSERT INTO table_name ("first", "last") values ("a","b")"

if(mysqli_query($connection, $insertRecordQuery)){ //behave as button

echo "saved";   

}

else{

echo "error".mysqli_error($connection);

}

?>

Add a comment
Know the answer?
Add Answer to:
I want solution by wampserver 4. Database Programming [8 Marks) a. Create a database in wampserver...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the MySQL Workbench create a new database using your design specifications Add at least 10...

    Using the MySQL Workbench create a new database using your design specifications Add at least 10 records to your tables. Note: Certain tables may not require 10 records and that is ok as long as your main tables have 10 or more Create MySQL statements that will retrieve all records or rows from the tables in your database Create 10 MySQL statements that will retrieve specified records or rows from one table in your database Create 10 MySQL statements that...

  • This project will create a GUI to access data held in a MySQL database. You will design a GUI usi...

    This project will create a GUI to access data held in a MySQL database. You will design a GUI using Swing components that will allow you to add a record, delete a record, update a record and display all current records int he database. The design is your choice. Extra credit will be given for the ability to search for a specific record by a key value. You will need to provide details of the database domain, table and record...

  • create a handler you can visit to set up your database table. It contains all the...

    create a handler you can visit to set up your database table. It contains all the fields needed to make a simple workout tracker. name - the name of the exercise reps - the number of times the exercise was performed weight - the weight of the weights used date - the date the exercise was performed lbs - a boolean indicating if the measurement is in lbs or kg. 1 indicates lbs, 0 indicates kgs. Requirements You need to...

  • PHP Programming In this project, you will create a Web page that allows visitors to your...

    PHP Programming In this project, you will create a Web page that allows visitors to your site to sign a guest book that is saved to a database. Create a new document in your text editor and type the <!DOCTYPE> declaration, <html> element, document head, and <body> element. Use the strict DTD and “Guest Book” as the content of the <title> element. Add the following text and elements to the document body: <h2>Enter your name to sign our guest book</h2>...

  • Rationale The focus of the project is to develop your database programming skills. This project will...

    Rationale The focus of the project is to develop your database programming skills. This project will help you get a fair idea of the sales and distribution system in any organization that has a chain of Carrying and Forwarding Agents (CFAs) or super stockists and stockists. You will be able to implement database programming concepts of ADO.NET in VB.NET and ASP.NET to create a real-life, web-based database application. (VB stands for Visual Basic.) Scenario Smooth Pen, Inc., a pen manufacturing...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • Answer the following and explain so I can double check my answers If you use the Management Studio to create a database, the Studio will automatically create a database file plus a ________________...

    Answer the following and explain so I can double check my answers If you use the Management Studio to create a database, the Studio will automatically create a database file plus a ______________________ file. 10 points    QUESTION 2 When you use the Management Studio to create a check constraint, you can specify whether you want the constraint enforced for insert or __________________ operations. 10 points    QUESTION 3 When you use the Management Studio to create a database, including its tables...

  • Programming Microsoft Visual Basic 2012/2015 - Create an SQL or Access database with all your friends’...

    Programming Microsoft Visual Basic 2012/2015 - Create an SQL or Access database with all your friends’ information and write a program to load the names in the combo box and also search the database and find your friend’s record off the database by name and retrieve all the information from the database to the form including your friend’s picture. You should be able to add new friends, update an existing friends’ information and delete a friend’s record. See the sample...

  • Through the remaining assignments due in this course, you will be creating a simple database for...

    Through the remaining assignments due in this course, you will be creating a simple database for tracking information about volunteers working and raising money for a community organization. This assignment requires that you create the initial table, called PERSON, to hold basic information about volunteers. You will be redefining the design and building the database in the upcoming unit assignments. 1.Use the mysqldump.exe command line tool to backup the data in your volunteer database. To access the mysqldump.exe tool, start...

  • Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accoun...

    Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accounting, and employee data, and these different data sets must all be efficiently managed in order to make the data accessible. Companies rely on database engineers to ensure that their records are accurate, updated, and tracked in real time. This course covers structured query language (SQL) and how it can be used to manage database schemas, manipulate data, and analyze data. For your final...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT