Skip to content

Instantly share code, notes, and snippets.

@SitesByYogi
SitesByYogi / link.html
Created June 22, 2023 00:31
HTML Link Tag
@SitesByYogi
SitesByYogi / paragraph.html
Created June 22, 2023 00:28
HTML Paragraph Tag
<p>This is a paragraph.</p>
@SitesByYogi
SitesByYogi / headings.html
Created June 22, 2023 00:24
HTML heading tags
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<!-- And so on... -->
@SitesByYogi
SitesByYogi / doc.html
Created June 22, 2023 00:20
An HTML document consists of several elements that define the structure and content of a web page. Here's a basic structure for an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>Your Title</title>
</head>
<body>
<!-- Your content goes here -->
</body>
</html>
@SitesByYogi
SitesByYogi / connect.php
Created June 21, 2023 22:32
PHP database interaction
<?php
// Connect to the database
$dsn = "mysql:host=localhost;dbname=mydatabase";
$username = "root";
$password = "password";
try {
$db = new PDO($dsn, $username, $password);
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
@SitesByYogi
SitesByYogi / form.html
Last active June 21, 2023 22:28
basic php form with HTML markup
<!-- HTML form -->
<form method="POST" action="process.php">
<input type="text" name="name" placeholder="Your name">
<input type="submit" value="Submit">
</form>
<?php
function greet($name) {
echo "Hello, " . $name . "!";
}
greet("John"); // Output: Hello, John!
?>
@SitesByYogi
SitesByYogi / loops.php
Created June 21, 2023 14:33
PHP Loops
<?php
// Loop through an array
$fruits = array("apple", "banana", "orange");
foreach ($fruits as $fruit) {
echo $fruit . "<br>";
}
// Perform a specific number of iterations
for ($i = 1; $i <= 10; $i++) {
echo $i . "<br>";
@SitesByYogi
SitesByYogi / conditionals.php
Created June 21, 2023 14:31
PHP Conditional Statements
<?php
$age = 18;
if ($age >= 18) {
echo "You are an adult.";
} elseif ($age >= 13 && $age < 18) {
echo "You are a teenager.";
} else {
echo "You are a child.";
}
@SitesByYogi
SitesByYogi / output.php
Created June 21, 2023 14:29
PHP Outputting Data
<?php
$name = "John Doe";
echo "Hello, " . $name . "!"; // Output: Hello, John Doe!
?>