12th Standard Syllabus & Materials
12th Standard
TN 12th Standard Biology Zoology - Reproduction in Organisms Creative Questions Study Material - QB365 Set D
NEW12th Standard
TN 12th Standard Biology Zoology - Reproduction in Organisms Creative Questions Study Material - QB365 Set C
NEW12th Standard
TN 12th Standard Biology Zoology - Reproduction in Organisms Creative Questions Study Material - QB365 Set B
NEW12th Standard
TN 12th Standard Biology Zoology - Reproduction in Organisms Creative Questions Study Material - QB365 Set A
NEW12th Standard
TN 12th Standard Physics Electronics and Communication Creative Questions Study Material - QB365 Set D
NEW12th Standard
TN 12th Standard Physics Electronics and Communication Creative Questions Study Material - QB365 Set C

Published on: 20/08/2019
Connecting PHP and MYSQL
Download Tamil Nadu 12th Standard Computer Applications question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Applications Test

1.
Connection to the Database Server machine via PHP scripting language using _______ Function
mysqlLaffected_rows( )
myvscu connect_.erron( )
mysqlLfetch_assoc( )
mysqli_connect( )
2.
Which of the following is not an RDBMS?
Oracle
IBM DB2
Microsoft SQLSERVER
None of these
3.
_______is important to all computer and Internet related applications
Data
MySQL
PHP
None of these
4.
Which is the not a correct MySQL Function in PHP ?
Mysqli_connect() Function
Mysqli_close() Function
mysqli_select_data() Function
mysqli_affected_rows() Function
5.
Which is the correct function Closing Connection in PHP ?
mysqli_close(“Connection Object”);
close(“Connection Object”);
mysql_close(“Connection Object”);
mysqli_close(“Database Object”);
6.
What is the main goal of MySQL and PHP connectivity?
7.
How many parameters to connect to database server, in Mysqli_connect( ) Function?
8.
What are the major operations of database?
9.
Expand RDBMS.
10.
Define mysqli_affected_rows() Function.
11.
Define mysqli_connect_error() Function
12.
What is the use of SQL statements in PHP?
13.
What is the main goal of MySQL and PHP connectivity?
14.
Wha is MySQL?
15.
Write a note PHP MySQL database connection.
16.
17.
Differentiate mysqli_affected_rows( ) Function and mysqli_fetch_assoc( ) Function.
18.
Write a short note on parameters of mysqli_connect( ) function?
19.
Explain in details types of MySQL connection method in PHP.
20.
Discuss in detail about MySQL functions with example.
1.
(d)
mysqli_connect( )
2.
(d)
None of these
3.
(a)
Data
4.
(c)
mysqli_select_data() Function
5.
(a)
mysqli_close(“Connection Object”);
6.
To retrieve and manipulate the data from MySQL database server.
7.
This function requires four parameters to connect to database server.
8.
INSERT, SELECT,UPDATE and DELETE.
9.
Relational Database Management System.
10.
1. The mysqli_affected_rows() function returns the number of affected rows in the previous SELECT, INSERT, UPDATE, REPLACE,or DELETE query.
2. Syntax
mysqli_affected_rows( connection);
11.
1.The mysqli_connect_error() function returns the error description from the last connection error, if any.
2.Syntax
mysqli_connect_error( );
12.
The SQL query statements are helping with PHP MySQL extension to achieve the objective of MySQL and PHP connection.
13.
The main goal of MySQL and PHP connectivity is to retrieve and manipulate the data from MySQL database server.
14.
(i) MySQL is the most popular Open Source Relational SQL Database Management System.
(ii) MySQL is one of the best RDBMS being used for developing various web-based software applications.
15.
Database Connections: Accessing MySQL Database, connect to Database Server machine via PHP scripting language using Mysqli_connect() Function.
Syntax:
mysqli_connect("Server Name","User Name","Password","DB Name");
This function requires four parameters to connect to database server. Database Server name, Database username, password and Database Name.
16.
17.
| mysqli_affected rows( ) | mysqli_fetch_assoc( ) |
|---|---|
| It returns the number of affected rows in the prearvious SELECT, INSERT UPDATE, REPLACE, or DELETE query. | It fetches a result rowas an associative aray |
| Return value: An integer >0 indicates the number of rows affected (0 indicates that no records were affected. '-1' indicates that the query returned an error). |
Returns an associative array of strings representing the fetched row. NULL if there are no more rows in result set. |
| Syntax: mysqli_affected_rows (connection); |
Syntax: mysqli fetch_as-soc(result); |
18.
(i) Four Parameters are used to connect to the Database server.
(ii) They are
1.$ servername -> Database Server server IP address
2.$ susername -> Database Server User Name
3.$ password -> Database Server Password
4.$ DB_Name -> Database Name
19.
Database Connections: Before accessing MYSQL Database, connect to Database Server machine via PHP scripting language using Mysqli_connect() Function.
Syntax:
mysqli_connect(“Server Name”,“User Name”,“Password”,“DB Name”);
This function requires four parameters to connect to database server. Database Server name, Database username, password and Database Name.
Managing Database Connections: The below code describes managing database connection methods and features.
<?php
$servername = “localhost”;
$username = “username”;
$password = “password”;
SDB_name = “School_DB”;
$conn = mysqli_connect($servername, $username, $password,$DB_name);
if(!$conn){
die(“Connection failed: “ . mysqli_connect_error( ));
}
echo “Connected successfully”;
?>
In the above code snippet, four variables are used to connect to the Database server. They are
The mysqli_connect function uses these variables and connect Database server to PHP. If connection gets fail, output will be printed with MySQL error code. Otherwise connection is success.
20.
MySQL function in PHP:
In PHP Scripting language many functions are available for MySQL Database connectivity and executing SQL queries.
MySQLi is extension in PHP scripting language which gives access to the MYSQL database. MySQLi extension was introduced version 5.0.0,
The MySQLi extension contains the following important functions which are related to MySQL database connectivity and management.
i) Mysqli_connect() Function
ii) Mysqli_close() Function
iii) Mysqli_query() Function
(i) Database Connections:
Before accessing MySQL Database, connect to Database Server machine via PHP scripting language using Mysqli_connect() Function.
Syntax :
mysqli_connect("Server Name "User Name","Password"DB Name");
This function requires four parameters to connect to database server. Database Server name, Database username, password anda Database Name.
(ii) Managing Database Connections :
The below code describes managing database connection methods and features.
The mysqli_connect function uses these variables to connect Database server to PHP. If connection gets fail, output will be printed with MySQL error code. Otherwise connection is success.
(iii) Performing Queries :
The main goal of MySQL and PHP connectivity is to retrieve and manipulate the data from MYSQL database server. The SQL query statements help in PHP MySQL extension to achieve the objective of MYSQL and PHP connection. "mysqli_query" is a function, that helps to execute the SQL query statements in PHP scripting language.
Syntax:
mysqli_query("Connection Object","SQL Query")
Example:
Closing Connection :
mysqli_close() Function is used to close an existing opened database connection between PHP scripting and MySQL Database Server.
12th Standard Syllabus & Materials
12th Standard
TN 12th Standard Physics Electronics and Communication Creative Questions Study Material - QB365 Set B
NEW12th Standard
TN 12th Standard Physics Electronics and Communication Creative Questions Study Material - QB365 Set A
NEW12th Standard
TN 12th Standard Physics Wave Optics Creative Questions Study Material - QB365 Set D
NEW12th Standard
TN 12th Standard Physics Wave Optics Creative Questions Study Material - QB365 Set C
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards