lnmp

How to Install PHP 7, NGINX & MySQL 5.6 on CentOS/RHEL 7.4 & 6.9

Few days back PHP version 7.2 has been released. Which has a number of changes and improvements over PHP version 7.X. This article will help you to install PHP 7, NGINX and MySQL 5.6 on CentOS / RHEL 7.4 & 6.9 operating systems. This tutorial has been tested with CentOS 7.4, so all the services command are used with systemctl, For CentOS 6 users change all systemctl command correspondence service command.

Read More

1-2-5_PHP-2

PHP To SQL

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
<?php
# 连接数据库
$con = mysql_connect("localhost","root","root");

if(!$con){
dir("Database Connect Error".mysql_error());
}else{
# 设定编码
mysql_query( "set names utf8" );

# 连接数据库
mysql_select_db("websafe",$con);

# 操作数据库
$result = mysql_query("select * from teacher");
echo "Show teachers in table<br />";
echo "<table border='2' width='300'>"
<tr><th>id</th><th>name</th><th>sex</th><th>addr</th> </tr>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>".$row["id"]."</td>";
echo "<td>".$row["name"]."</td>";
echo "<td>".$row["sex"]."</td>";
echo "<td>".$row["addr"]."</td>";
echo "</tr>";
}
echo "</table>";
}

# 关闭数据库
mysql_close($con);
?>

Read More