Skip to content

Instantly share code, notes, and snippets.

View VictorFursa's full-sized avatar
🙃
Focusing

Victor Fursa VictorFursa

🙃
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Города</title>
</head>
<body>
<form method="POST" action="city.php">
Город: <br>
<input type="text" name="city"/><br>
<?php
try
{
$pdo = new PDO("mysql:host=localhost;dbname=joke_db", "root", "");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('SET NAMES "utf8"');
}
catch (PDOException $e)
{
$output = 'Невозможно подключиться к серверу баз данных :('. " <br>" .$e->getMessage();
<?php
header('Content-Type: text/html; charset=utf-8');
class Cars{
public $mark;// марка
public $type; // тип
public $tonnage; // тонаж
}
class Truck extends Cars {
public function __construct(){
echo $this->mark = "MAN ";
<?php
header('Content-Type: text/html; charset=utf-8');
class Cars{
protected $mark;// марка
public $type; // тип
public $tonnage; // тонаж
protected $places; // места
public function setMark($mark,$places){
echo $mark . " " . $places . " мест";
}
<?php
include_once("connectDatabases.php");
?>
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<title>Добовление товаров</title>
</head>
<body>
<?php
include_once("connectDatabases.php");
if(isset($_POST['add_categories'])) {
$parent_id = $_POST['parent_id'] ;
$name = $_POST['add_categories'];
mysql_query("INSERT INTO categories (parent_id, name) VALUES('$parent_id','$name')");
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
<?php
//phpinfo(); exit;
header('Content-Type: text/html; charset=utf-8');
$a = array(
array(
"id" => 1,
"parent_id" => 0,
"name" => "Электротовары"
),
<?php
//phpinfo(); exit;
header('Content-Type: text/html; charset=utf-8');
$a = array(
array(
"id" => 1,
"parent_id" => 0,
"name" => "Электротовары"
),
<?php
//phpinfo(); exit;
header('Content-Type: text/html; charset=utf-8');
$a = array(
array(
"id" => 1,
"parent_id" => 0,
"name" => "Электротовары"
),
array(
<?php
include_once("connectDatabases.php");
class GuestBook{
private $firstName;
private $email;
private $message;
function __construct($firstName,$email,$message){
$this->firstName = $firstName;
$this->email = $email;
$this->message = $message;