Exercise on PHP MySQL

  1. Create one table with header row with primary class ( boostrap ).
  2. Add ten rows with alternating background colours ( use bootstrap )
  3. Using PHP or any other language generate 10 rows of data using loop. ( use for loop in PHP )
  4. Check that each row of data shows one serial number and this number is incremented within the loop.

Using PHP MySQL database.

  1. Using the above concepts , try to collect ten records from student table and display one record in one row. Each row should have alternate background colour ( bootstrap table class table-striped ) .
  2. Add link to student name and onclick of the link, one page will open and it will allow you to update the mark obtained by student. Use the student id in GET method to pass the unique id to edit page.
  3. Add a link for each record to delete the record from the table. It will ask for confirmation message before deleting the record.
  4. Create a page to add a new student record to table. ( use four input fields to add name, class, mark and sex )
  5. Change the class field to dropdown list to select the class.
  6. Change the sex field to radio button to select Male or Female.
  7. Add all validation at backend to show error message if any input is wrong.

Additional Questions

  1. Write a PHP script that updates a user’s email in a MySQL database based on their username. Use prepared statements to prevent SQL injection.
  2. Create a form to delete a record from a MySQL database by entering a user ID. Validate the input before executing the query.
  3. Write a PHP function that fetches all user records from a MySQL database and returns them as a JSON object.
  4. Modify the existing connection code to use MySQLi instead of PDO for database interaction.
  5. Write a script to display the total number of records in a specific MySQL table, such as "users".
  6. Using pagination, retrieve 10 records at a time from the "users" table and display them in a paginated format on a webpage.
  7. Create a PHP script that checks if a username already exists in the MySQL database before inserting a new record.
  8. Write a PHP function to execute a SELECT query that uses a JOIN between two tables (e.g., users and orders).
  9. Build a form that lets users search for records in a MySQL database based on a keyword and display the results.
  10. Implement a script to backup a specific MySQL table into a CSV file using PHP.


Back to PHP MySQL
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com











    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer