PHP mysqli and PDO Functions

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/26

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts, functions, and definitions related to PHP mysqli and PDO operations.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

27 Terms

1
New cards

What is the purpose of mysqli_connect() in PHP?

It establishes a connection to a MySQL database server using provided credentials.

2
New cards

What does mysqliconnecterrno() return?

It returns the error code from the last failed connection attempt.

3
New cards

What does mysqliconnecterror() provide?

A human-readable error message describing the last connection error.

4
New cards

Why should mysqli_close() be used?

To close an active connection to the MySQL database and free up resources.

5
New cards

What is the function of mysqli_query()?

It sends SQL queries to the MySQL database for execution.

6
New cards

What is the advantage of using mysqlimultiquery()?

It allows the execution of multiple SQL queries in a single call.

7
New cards

What does mysqlifetchassoc() return?

It fetches a row from a result set as an associative array.

8
New cards

How does mysqlifetcharray() differ from mysqlifetchassoc()?

mysqlifetcharray() returns a row as an associative, numeric, or both types of arrays.

9
New cards

What does mysqlifetchobject() return?

It returns a row from a result set as an object, with column names as properties.

10
New cards

What does mysqlifetchrow() return?

It retrieves a row as a numerical array indexed starting from 0.

11
New cards

What is the use of mysqlinumrows()?

It returns the total number of rows in a result set.

12
New cards

What is the purpose of mysqli_prepare()?

It prepares an SQL statement for execution to help prevent SQL injection.

13
New cards

What does mysqlistmtbind_param() do?

It binds variables to a prepared SQL statement as parameters.

14
New cards

What does mysqlistmtexecute() do?

It executes a previously prepared SQL statement.

15
New cards

What is the function of PDO::__construct?

It creates a new database connection using PDO.

16
New cards

What does PDO::beginTransaction() do?

It starts a database transaction.

17
New cards

What is the effect of calling PDO::commit()?

It saves all changes made during a transaction.

18
New cards

What happens when PDO::rollBack() is called?

It cancels all changes made during a transaction.

19
New cards

What is the use of PDO::setAttribute()?

It sets PDO attributes such as error mode or fetch mode.

20
New cards

What does PDO::exec() do?

It executes an SQL command like INSERT, UPDATE, or DELETE.

21
New cards

What does PDO::prepare() do?

It prepares an SQL statement for execution and prevents SQL injection.

22
New cards

What does PDO::lastInsertId() return?

It returns the ID of the last inserted row.

23
New cards

What information does PDO::errorInfo() return?

It provides detailed error information for debugging.

24
New cards

What does PDO::ATTR_AUTOCOMMIT do?

It determines whether changes to the database are automatically committed.

25
New cards

What is the function of PDO::ATTR_CASE?

It controls how column names are returned in result sets.

26
New cards

What does PDO::ATTR_ERRMODE control?

It sets the error reporting mode for PDO.

27
New cards

What is the purpose of PDO::ATTR_TIMEOUT?

It sets the connection timeout in seconds.