Advanced_PHP_Viva_Questions
Advanced_PHP_Viva_Questions
Q: What is MySQL?
A: MySQL is an open-source relational database management system.
Q: What are some basic database terms?
A: - Table: collection of data in rows and columns
- Row: a single record
- Column: a field of the record
Q: What are MySQL data types?
A: - INT: Integer numbers
- VARCHAR: Variable-length strings
- DATE: Date values
- FLOAT: Decimal numbers
Q: How do you connect PHP with MySQL?
A: Using mysqli or PDO.
Example (mysqli):
$conn = new mysqli('localhost', 'user', 'pass', 'db');
Q: How do you insert data into MySQL using PHP?
A: Use SQL INSERT query.
Example:
mysqli_query($conn, "INSERT INTO table (col) VALUES ('val')");
Q: How do you retrieve data from MySQL using PHP?
A: Use SELECT query and fetch using mysqli_fetch_assoc().