427,106 views
44 votes
44 votes
Question 1 The PHP method used to get information from a database is which of the following (including all necessary arguments): mysql_query(query, database name) mysql_connect(query, database name) mysql_query(query, connection) mysql_connect(query, connection) Question 2 The type of cookie that allows a web server to know whether or not a user is logged in is a: Group of answer choices httponlycookie securecookie authenticationcookie securitycookie Question 3 The PHP method used to get information from a database is which of the following (including all necessary arguments): mysql_query(query, database name) mysql_connect(query, database name) mysql_query(query, connection) mysql_connect(query, connection)

User Soubhik Mondal
by
2.9k points

1 Answer

24 votes
24 votes

Answer:

The PHP method used to get information from a database is mysql_query(query, connection), where "query" is the SQL query to be executed and "connection" is the database connection resource created by mysql_connect().

The type of cookie that allows a web server to know whether or not a user is logged in is a securecookie. Secure cookies are encrypted and can only be accessed by the server that created them. This makes them useful for storing information that needs to be kept secure, such as authentication information.

The PHP method used to get information from a database is mysql_query(query, connection), where "query" is the SQL query to be executed and "connection" is the database connection resource created by mysql_connect(). This method executes the given SQL query and returns a result set or a boolean value indicating whether the query was successful. For example, the following code connects to a database, executes a query to select all records from a table, and prints the resulting data:

$connection = mysql_connect('host', 'username', 'password');

$result = mysql_query('SELECT * FROM table_name', $connection);

while ($row = mysql_fetch_assoc($result)) {

print_r($row);

}

In this code, the mysql_query function is used to execute the SQL query and get the result set from the database. The mysql_fetch_assoc function is then used to iterate over the rows in the result set and print the data for each row.

User Karena
by
3.4k points