PHP Interview Question and Answers
46. |
Explain mysql_error(). |
|
The mysql_error() message will tell us what was wrong with our query, similar to the message we would receive at the MySQL console.
|
|
|
47. |
What types of MYSQL function available in PHP? |
|
|
Database Function |
Descriptions |
1. |
mysql_connect() |
Opens a connection to a MySQL server. |
2. |
mysql_pconnect() |
Opens a persistent connection. |
3. |
mysql_selectdb() |
Selects the default database. |
4. |
mysql_change_user() |
Changes the identity of the user logged on. |
5. |
mysql_list_dbs |
Lists databases for this MySQL server. |
6. |
mysql_list_tables |
Lists tables in the database. |
|
|
|
48. |
How to get no. of rows using MYSQL function? |
|
|
Database Function |
Descriptions |
1. |
mysql_fetch_assoc() |
Returns one result row, as an associative array. |
2. |
mysql_fetch_row() |
Returns one result row, as an array. |
3. |
mysql_affected_rows() |
Returns number of rows affected by query. |
4. |
mysql_num_rows() |
Returns number of rows selected. |
5. |
mysql_list_dbs |
Lists databases for this MySQL server. |
6. |
mysql_fetch_object() |
Returns a result row, as an object. |
|
|
|
49. |
Explain mysql_errno(). |
|
Returns the numerical value of the error message from previous MySQL operation. |
|
|
50. |
What types of MYSQL function available for affecting columns |
|
Array |
Descriptions |
mysql_fetch_field() |
Gets column information from a result and returns as an object. |
mysql_field_name() |
Gets the name of the specified field in a result. |
mysql_list_fields() |
Sets result pointer to a specified field offset. |
mysql_num_fields() |
Gets number of fields in a result. |
mysql_field_seek() |
Sets result pointer to a specified field offset. |
mysql_field_type() |
Gets the type of the specified field in a result. |
mysql_field_len() |
Returns the length of the specified field. |
mysql_field_table() |
Gets name of the table the specified field is in. |
mysql_tablename() |
Gets table name of field. |
|
|
|