Examveda

Which variable is a handle to a database object?

A. $dbh

B. $sth

C. $fh

D. $h

Answer: Option A

Solution (By Examveda Team)

This question is about how MySQL interacts with databases. Imagine you want to talk to a database. You need a way to connect to it and work with it.

In MySQL, database handles are special variables that let you do just that. They act like a bridge between your code and the database.

Let's break down the options:

Option A: $dbh
This is the most common variable used for a database handle. It stands for "database handle". Think of it as the key to your database door!

Option B: $sth
This variable is used for a prepared statement handle. It's like a special instruction set that tells the database how to perform a particular task.

Option C: $fh
This variable is generally used for file handles, not database handles.

Option D: $h
While "$h" might be used in some code, it's not a standard variable for database handles.

So, the answer is Option A: $dbh. It's the variable used for a database handle!

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous