-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
142 lines (125 loc) · 5.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html>
<head>
<title>Tutorial PHP - Mocanu Valentin</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Valentin Mocanu - RontavStudio">
<link rel="shortcut icon" href="favicon.ico">
<link href='http://fonts.googleapis.com/css?family=Lato:300,400,300italic,400italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/styles/tomorrow-night.min.css">
</head>
<body data-spy="scroll">
<section id="promo" class="promo section offset-header">
<div class="container text-center">
<h2 class="title">PHP <span class="highlight">Tutorial</span></h2>
<p class="intro">
PHP = Hypertext Preprocessor
</p>
<ul class="meta list-inline">
<li><a href="https://github.com/rontav/cnu" target="_blank">View on GitHub</a></li>
<li>Created by: <a href="http://rontavstudio.com/" target="_blank">Valentin Mocanu</a> at <a href="http://rontavstudio.com/" target="_blank">RontavStudio</a></li>
</ul>
</div>
</section>
<section id="examples" class="docs section">
<div class="container">
<div class="docs-inner">
<h2 class="title text-center">Let's get started</h2>
<div class="block">
<div class="code-block">
<pre><code class="php"><?php
echo "Hello World";
?></code></pre>
</div>
<div class="code-block">
<pre><code class="php"><?php
$numar = 10;
$text1 = "Marcel";
$text2 = "Vasile";
if($numar == 10){
echo $text1;
}
else{
echo $text2;
}
?></code></pre>
</div>
</div>
<div class="block">
<h3 class="sub-title text-center">Conexiune la baza de date</h3>
<hr>
<div class="code-block">
<pre><code class="php"><?php
$servername = "localhost";
$username = "username";
$password = "password";
$db = "databaseName";
$conn = new PDO("mysql:host=$servername;dbname=$db", $username, $password) or die('Nu am putut realiza conexiunea la baza de date!');
echo "Conexiune realizată cu succes!";
?></code></pre>
</div>
<h3 class="sub-title text-center">Introducere de date într-o tabelă</h3>
<div class="code-block">
<pre><code class="php"><?php
$nume = "Anișoara";
$cnp = "1970112392469";
$email = "anisoara@gmail.com";
$sql = "INSERT INTO catalog (nume, cnp, email) VALUES (?, ?, ?)"; // `catalog` este numele tabelei
$send = $conn -> prepare($sql);
$send -> execute(array($nume, $cnp, $email)) or die("A apărut o eroare la introducerea datelor");
?></code></pre>
</div>
<h3 class="sub-title text-center">Extragerea datelor dintr-o tabelă</h3>
<div class="code-block">
<pre><code class="php"><?php
$nume = 'Măriuca';
$sql = "SELECT * FROM catalog WHERE nume = ?";
$send = $conn -> prepare($sql);
$send -> execute(array($nume));
$data = $send -> fetchAll(PDO::FETCH_ASSOC);
print_r($data); // afișare
?></code></pre>
</div>
<h3 class="sub-title text-center">Modificarea datelor dintr-o tabelă</h3>
<div class="code-block">
<pre><code class="php"><?php
$nume = "'Tușa Geta";
$numeNou = 'Vasile';
$cnp = '1970512392469';
$sql = "UPDATE catalog SET nume=? WHERE $nume=? AND $cnp=?";
$send = $conn -> prepare($sql);
$send -> execute(array($numeNou, $nume, $cnp)) or die("A apărut o eroare la modificarea datelor");
?></code></pre>
</div>
<h3 class="sub-title text-center">Ștergerea datelor dintr-o tabelă</h3>
<div class="code-block">
<pre><code class="php"><?php
$email = 'țața_dolores@yahoo.com';
$sql = "DELETE FROM catalog WHERE email = ?";
$send = $conn -> prepare($sql);
$count = $send -> execute(array($email));
echo "Am șters ". $count ." intrări din tabelă";
?></code></pre>
</div>
</div>
</div>
</div>
</section>
<footer class="footer">
<div class="container text-center">
<small>This page was designed with <i class="fa fa-heart"></i> by <a href="http://themes.3rdwavemedia.com" target="_blank">Xiaoying Riley</a> for developers</small>
</div>
</footer>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
<script type="text/javascript" src="js/MercuryModal.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>