Summer 2023 WBP
Summer 2023 WBP
allotted.
While the PDF doesn’t provide the answers, here are four advantages of PHP:
* It is cross-platform.
To elaborate:
© Define introspection.
Define introspection.
* Name
* Value
* Expiry date
* Domain
* Path
* Secure
<?php
$servername = “your_servername”;
$username = “your_username”;
$password = “your_password”;
$database = “your_database”;
// Create connection
// Check connection
If (!$conn) {
?>
<?php
$x = 1;
Do {
$x++;
?>
<?php
$serialized_data = serialize($data);
Echo $serialized_data;
// To unserialize:
// $unserialized_data = unserialize($serialized_data);
// print_r($unserialized_data);
?>
Sending email in PHP typically involves using the mail() function. It requires
specifying the recipient’s email address, the subject, the message, and
optionally, headers.
<?php
$to = recipient@example.com;
?>
Web page validation involves checking if the code (HTML, CSS, JavaScript)
conforms to web standards. This ensures consistency and proper rendering
across browsers.
<?php
// Update
$sql = “UPDATE users SET name=’Jane Doe’ WHERE id=1”;
Mysqli_query($conn, $sql);
// Delete
Mysqli_query($conn, $sql);
?>
<?php
Function greet($name) {
?>
* Overloading: Creating multiple methods with the same name but different
parameters (not directly supported in PHP in the traditional sense, but can be
achieved with __call() or variable argument functions).
* Inserting: Using SQL INSERT statements to add new data into a database
table.
This would typically involve using HTML form elements (text boxes, buttons,
etc.) to create a basic graphical user interface in a web page.
<!DOCTYPE html>
<html>
<head>
<title>My Form</title>
</head>
<body>
<form>
<label for=”name”>Name:</label><br>
<label for=”email”>Email:</label><br>
</form>
</body>
</html>
(a) Implement any three data types used in PHP with illustration.
<?php
// String
// Integer
$age = 30;
?>
<?php
$servername = “your_servername”;
$username = “your_username”;
$password = “your_password”;
$database = “your_database”;
// Create connection
// Check connection
If (!$conn) {
?>
(a) Describe form controls text box, text area, radio button, check box, list
& buttons.
Describe form controls text box, text area, radio button, check box, list &
buttons.
* Radio button: Allows the user to select one option from a group. <input
type=”radio”>
* Check box: Allows the user to select one or more options. <input
type=”checkbox”>
Creating PDF documents in PHP often involves using libraries like TCPDF or
FPDF. Here’s a conceptual outline (you’d need to include the library):
<?php
// Include a PDF library (e.g., TCPDF)
Require_once(‘tcpdf/tcpdf.php’);
// Add a page
$pdf->AddPage();
// Set font
// Write content
?>
(i) Call ()
(ii) Mysqli connect ()
* (i) call(): It seems like there might be a slight typo here. PHP has the
__call() magic method. The __call() method is invoked when an inaccessible
method is called on an object. It provides a way to dynamically handle
method calls.
* (ii) mysqli_connect(): This is a PHP function used to establish a connection
to a MySQL database. It takes parameters like the server hostname,
username, password, and database name.