Question

1. Write the php statements to connect to MySQL server and select the database named personnel....

1. Write the php statements to connect to MySQL server and select the database named personnel. The database personnel is located at localhost server. The user id and password to log on to the server are finalexam and thePassword respectively. 2. Using the above connection, write the php statements to retrieve the name and the email fields from all records of the users table ( 'SELECT name, email FROM users') and display them one record per line.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

--1

<?php
    $mysqli = new mysqli("localhost", "finalexam", "thePassword", "personnel");
?>

Above is PHP code to connect to database. Mysqli helps to establish connection.

--2

<?php
    $result = $mysqli->query("SELECT name,email FROM users");
?>

Above query to to be used along with 1st solve to get results from db.

Add a comment
Know the answer?
Add Answer to:
1. Write the php statements to connect to MySQL server and select the database named personnel....
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
  • 1.Write a PHP function that generates a random email. 2.Write a PHP function that generates a...

    1.Write a PHP function that generates a random email. 2.Write a PHP function that generates a random password given the length as a parameter. 3. Run a query that will generate a database named lab4 b. 4.Run a query that will create a table named users, the table will only have three columns, email TEXT and password TEXT, ID INTEGER NOT NULL AUTO_INCREMENT. ID will be the primary key that will be generated for us automatically based on the record...

  • Using PHP and MYSQL create a form that: user Full name user Comment (as many lines...

    Using PHP and MYSQL create a form that: user Full name user Comment (as many lines as they want) allows the user to attach one image uploads the Full name, comment, and image to a database Displays the user's full name, comment and user image on the website by selecting them from the database. Include the server connection file as well any necessary codes to connect and maintain the database

  • How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow...

    How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow user to add his name and email to my database, all I need to print my final database when the user click on submit. <form action="" method="post"> <label>Name :</label> <input type="text" name="name" required="required" placeholder="Please Enter Name"/><br /><br /> <label>Email :</label> <input type="email" name="email" required="required" /><br/><br /> <input type="submit" value=" Submit " name="submit"/><br /> </form>...

  • 1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

    1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 2. Write a script that (1) creates a login ID named “RobertHalliday” with the password “HelloBob”; (2) sets the default database for the login to the MyGuitarShop database; (3) creates a user named “RobertHalliday” for the login; and (4) assigns the user...

  • Create a folder named "TrainerApp". In that folder create the following files. Create a PHP file,...

    Create a folder named "TrainerApp". In that folder create the following files. Create a PHP file, "insert-user-form.php", with a form that has the following fields: - First Name (text) - Last Name (text) - Email (text) - Password (text) - Submit button Create another PHP file, "insert-exercise-form.php" with a form that has the following fields: - Exercise Name (text) - Description (text) - Demonstration Image (file) - Submit button Create another PHP file, "login-user-form.php" with a form that has the...

  • Write a PHP script that obtains a URL and its description from user and stores the...

    Write a PHP script that obtains a URL and its description from user and stores the information into a database using MySQL. Create and run a SQL script with database named URL and a table named Urltable. The first field of the table should contain an actual URL, and the second, which is named Description, should contain a description of the URL. Use www.deitel.com as the first URL, and input Cool site! as its description. The second URL should be...

  • Platform: ssh server PHP and mySQL database Transaction Input: Transaction Name Transaction Type: Purchase, Income, Tax...

    Platform: ssh server PHP and mySQL database Transaction Input: Transaction Name Transaction Type: Purchase, Income, Tax Payment Overall Amount Number of unit and price for Purchase Beneficiaries:(multiple choice of persons in the family) Database record for each order: All input information as above (multiple choices can be combined into one string and be stored in one field) Transaction id Basic functions on webpage Create a new transaction List all transactions Search Transaction by id Bonus Functions Show the overall balance...

  • You need to implement a web application that is split in three parts, namely, Webpage, PHP and My...

    You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...

  • 1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

    1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 3) Write a script that uses dynamic SQL and a cursor to loop through each row of the Administrators table and (1) create a login ID for each row in that consists of the administrator�s first and last name with no space...

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