CentOS (Community Enterprise Operating System) is a Linux distribution based on the freely available source code of Red Hat Enterprise Linux (RHEL). The key differences between CentOS and CentOS Stream are as follows:

 

- Release Model

CentOS follows a traditional stable release model, where major versions are released periodically with long-term support. CentOS Stream, on the other hand, is a rolling-release distribution that provides continuous updates and is closely aligned with the development of the upcoming Red Hat Enterprise Linux (RHEL) releases.

 

- Upstream Relationship

CentOS is based on the source code of RHEL after it has been released. In contrast, CentOS Stream is based on the upstream development branch of RHEL, which means it receives updates and features before they are included in a stable RHEL release. CentOS Stream acts as a testing ground and provides feedback to the RHEL development process.

 

- Early Access to Updates

CentOS Stream users have early access to updates and improvements before they are incorporated into a stable RHEL release. This allows users to test and provide feedback on new features and updates, which can help shape the future development of RHEL.

If you are developing an Application in PHP and using MySQL as Database provider, you will need to store data using an INSERT operation. Follow these steps:

  • Connect to the MySQL server.
  • Build the SQL query with the appropriate `INSERT` statement and data.
  • Execute the query.4. Handle any potential errors.

Examples:

Basic INSERT with static values

// Step 1: Connect to MySQL server
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$database = "your_database";

$conn = new mysqli($servername, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

// Step 2: Build the SQL query
$sql = "INSERT INTO users (name, email, age) VALUES ('John Doe', This email address is being protected from spambots. You need JavaScript enabled to view it.', 30)";

// Step 3: Execute the query
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

// Step 4: Close the connection
$conn->close();

 

INSERT with dynamic values using prepared statements (recommended to prevent SQL injection)

Updating data in a MySQL database using PHP involves using the UPDATE statement. Here are some examples of how to perform updates using PHP:

Assuming you have a MySQL database set up and a table named users with columns id, username, and email, the following examples demonstrate different scenarios for updating data.

 

Updating a Single Field for a Specific User:

// Connect to the database
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "your_database";

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

// Update the email for a specific user with id = 1
$user_id = 1;
$new_email = "This email address is being protected from spambots. You need JavaScript enabled to view it.";

$sql = "UPDATE users SET email='$new_email' WHERE id=$user_id";

if ($conn->query($sql) === TRUE) {
echo "Email updated successfully";
} else {
echo "Error updating email: " . $conn->error;
}

$conn->close();

 

Updating Multiple Fields for a Specific User:

Examples of using PHP to perform a DELETE operation in MySQL. Before running these examples, make sure you have established a connection to your MySQL database using the appropriate credentials.

Deleting a single record based on a specific condition.

// Replace these variables with your actual database credentials
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "your_database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

// Delete a single record based on a condition
$idToDelete = 123; // Replace with the primary key value of the record you want to delete

$sql = "DELETE FROM your_table_name WHERE id = $idToDelete";

if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully.";
} else {
echo "Error deleting record: " . $conn->error;
}

$conn->close();

 

Deleting multiple records based on a condition.