`

php 增删改查

阅读更多

sql

CREATE TABLE IF NOT EXISTS `o_code` (
  `o_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '//id',
  `o_english` varchar(50) NOT NULL COMMENT '//单词',
  `o_symbol` varchar(50) DEFAULT NULL COMMENT '//音标',
  `o_info` varchar(250) DEFAULT NULL COMMENT '//说明',
  `o_time` datetime NOT NULL COMMENT '//发布时间',
  `o_out` char(1) NOT NULL COMMENT '//回收站',
  `o_type` smallint(6) NOT NULL COMMENT '//分类',
  PRIMARY KEY (`o_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='//代码单词表' AUTO_INCREMENT=1 ;

INSERT INTO `o_code` (`o_id`, `o_english`, `o_symbol`, `o_info`, `o_time`, `o_out`, `o_type`) VALUES
(1, 'input', '[ˈɪnˌpʊt]', '输入', '2016-01-06 17:49:13', '0', 3),
(2, 'form', '[fɔ:rm]', '表单', '2016-01-06 17:55:15', '0', 3),
(3, 'button', '[ˈbʌtn]', '按钮', '2016-01-06 17:56:12', '0', 3),
(4, 'section', '[ˈsɛkʃən]', '定义文档中的节', '2016-01-06 18:02:36', '0', 3),
(5, 'header', '[ˈhɛdɚ]', '定义文档的页眉', '2016-01-06 19:50:02', '0', 3),
(6, 'caption', '[ˈkæpʃən]', '定义表格标题', '2016-01-06 19:51:35', '0', 3),
(7, 'address', '[ˈædres]', '地址', '2016-01-06 19:53:00', '0', 3),
(8, 'article', '[ˈɑ:rtɪkl]', '内容', '2016-01-06 19:53:56', '0', 3),
(9, 'footer', '[ˈfʊtɚ]', '底部', '2016-01-06 19:54:50', '0', 3),
(10, 'table', '[ˈtebəl]', '表格', '2016-01-06 19:56:03', '0', 3);

 

mysql.func.php

<?php
// 防止恶意调用
if (! defined ( 'IN_TG' )) {
	exit ( 'Access Defined!' );
}

// _connect() 连接MYSQL数据库
function _connect() {
	// global 表示全局变量的意思,意图是将此变量在函数外部也能访问
	global $_conn;
	if (! $_conn = @mysql_connect ( DB_HOST, DB_USER, DB_PWD )) {
		exit ( '数据库连接失败' );
	}
}
// _select_db选择一款数据库
function _select_db() {
	if (! mysql_select_db ( DB_NAME )) {
		exit ( '找不到指定的数据库' );
	}
}
// 设置字符集
function _set_names() {
	if (! mysql_query ( 'SET NAMES UTF8' )) {
		exit ( '字符集错误' );
	}
}
// 获取一条数据
function _query($_sql) {
	if (! $_result = mysql_query ( $_sql )) {
		exit ( 'SQL执行失败' );
	}
	return $_result;
}
// 获取一批数据
function _fetch_array($_sql) {
	return mysql_fetch_array ( _query ( $_sql ), MYSQL_ASSOC );
}
// 关闭数据库
function _close() {
	if (! mysql_close ()) {
		exit ( '关闭异常' );
	}
}
?>

 

close.inc.php

<?php
// 防止恶意调用
if (! defined ( 'IN_TG' )) {
	exit ( 'Access Defined!' );
}
_close ();
?>

 

common.inc.php

<?php
// 防止恶意调用
if (! defined ( 'IN_TG' )) {
	exit ( 'Access Defined!' );
}

// 设置字符集编码
header ( 'Content-Type: text/html; charset=utf-8' );

// 转换硬路径常量
define ( 'ROOT_PATH', substr ( dirname ( __FILE__ ), 0, - 8 ) );

// 引入函数库
require ROOT_PATH . 'includes/mysql.func.php';

// 数据库连接
define ( 'DB_HOST', 'localhost' );
define ( 'DB_USER', 'root' );
define ( 'DB_PWD', '123456' );
define ( 'DB_NAME', 'osweb' );

// 初始化数据库
_connect (); // 连接MYSQL数据库
_select_db (); // 选择指定的数据库
_set_names (); // 设置字符集

?>

 

type.func.php

<?php
//防止恶意调用
if (! defined ( 'IN_TG' )) {
	exit ( 'Access Defined!' );
}

//存放代码分类
function _type(){
	$_type = array('[Z]','[B]','[H]','[D]','[J]','[Q]','[P]','[X]','[S]','[I]','[C]','[M]');
	return $_type;
}

//存放代码分类说明
function _info_type(){
	$_type = array('其他','bootstrap','html5','dede','javascript','jquery','php','html4','style','id','class','mysql');
	return $_type;
}
?>

 

index.php

<?php 
	define('IN_TG',true);
	require dirname(__FILE__).'/includes/common.inc.php';
	require ROOT_PATH.'includes/type.func.php';
	$_type_arr = _type();
	$_info_type = _info_type();
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<meta name="robots" content="noindex,nofollow">
<title>代码单词</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body {font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif;}
.english{ color: #333}
.english:link{ color: #333; text-decoration: none;}
.english:visited{ color: #333; text-decoration: none;}
.english:hover{ color: #333; text-decoration: none;}
.english:active{ color: #333; text-decoration: none;}
</style>
</head>
<body style="margin: 10px;">
<form action="index.php" method="get">
	<div class="input-group">
		<input type="text" class="form-control" name="search">
		<span class="input-group-btn">
			<button class="btn btn-primary" type="submit">搜索</button>
		</span>
	</div>
</form>
<br>
<div class="btn-group pull-right">  
    <a class="btn btn-primary" href="?sort=1">最新</a>  
    <a class="btn btn-primary" href="?sort=2">最旧</a>  
    <a class="btn btn-primary" href="?sort=3">A-Z</a>
    <a class="btn btn-primary" href="?sort=4">Z-A</a>
    <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
    	分类  
       <span class="caret"></span>  
    </a>  
    <ul class="dropdown-menu">
    	<?php 
			for($i=1;$i<count($_type_arr);$i++){
				echo "<li><a href=\"?type=".($i+1)."\">$_type_arr[$i]$_info_type[$i]</a></li>";
			}
		?>
		<li class="divider"></li>
		<?php echo "<li><a href=\"?type=1\">$_type_arr[0]$_info_type[0]</a></li>"; ?>
    </ul>
</div>
<br>
<table class="table table-striped table-hover"> 
	<thead>
		<tr>
			<th>单词</th>
			<th>音标</th>
			<th>说明</th>
		</tr>
	</thead>
	<tbody>
<?php
	$_search = trim($_GET['search']);
	$_sort = $_GET['sort'];
	$_type = $_GET['type'];
	$_page=$_GET['page'];//获取当前的页数
	$_page_show =3;//最大显示3页
	$_page_size =10;//显示每页的条数
	if($_page == null || $_page<=0){
		$_page =1;
	}
	$_page_begin = ($_page-1) * $_page_size;
	$_sql_list = "SELECT * FROM o_code WHERE o_out='0' ";
	if($_search !=null){
		$_sql_list.= " AND o_english LIKE '%$_search%' order by o_time DESC LIMIT $_page_begin , $_page_size";
	}else if($_sort !=null){
		switch ($_sort){
			case 1:
				$_sql_list.= "order by o_time DESC LIMIT $_page_begin , $_page_size";
			break;
			case 2:
				$_sql_list.= "order by o_time ASC LIMIT $_page_begin , $_page_size";
			break;
			case 3:
				$_sql_list.= "order by o_english ASC ,o_time DESC LIMIT $_page_begin , $_page_size";
			break;
			case 4:
				$_sql_list.= "order by o_english DESC ,o_time DESC LIMIT $_page_begin , $_page_size";
				break;
			default:
				$_sql_list.= "order by o_time DESC LIMIT $_page_begin , $_page_size";
		}
	}else if($_type !=null){
		$_sql_list.= " AND o_type = '$_type' order by o_english ASC LIMIT $_page_begin , $_page_size";
	}else{
		$_sql_list.= "order by o_time DESC LIMIT $_page_begin , $_page_size";
	}
	$_result = _query($_sql_list);
    while (!!$row = mysql_fetch_array($_result)){
?>
		<tr>
			<td><a href="http://dict.baidu.com/s?wd=<?php echo $row[o_english]?>" target="_blank" class="english"><?php echo $row[o_english]?></a></td>
			<td><?php echo $row[o_symbol]?></td>
			<td><?php echo $_type_arr[$row[o_type]-1]; ?><?php echo $row[o_info]?></td>
		</tr>
<?php
    }
?>  
	</tbody>
</table>
<ul class="pagination pull-right">
<?php
$_sql_count = "SELECT count( o_id ) FROM o_code WHERE o_out='0' "; 

//获取参数
$_con = '';
if($_search !=null){
	$_sql_count.= "AND o_english LIKE '%$_search%'";
	$_con = "search=$_search&";
}else if($_sort !=null){
	$_con = "sort=$_sort&";
}else if($_type !=null){
	$_sql_count.= " AND o_type = '$_type'";
	$_con = "type=$_type&";
}

//分页
$_answers = mysql_fetch_array(_query($_sql_count));
$_allcount= $_answers[0];
$_page_count = ceil($_allcount/$_page_size);
if($_page <= 1 || $_page == '') $_page = 1;
if($_page >= $_page_count) $_page = $_page_count;
$_pre_page = ($_page == 1)? 1 : $_page - 1;
$_next_page= ($_page == $_page_count)? $_page_count : $_page + 1 ;
$_pagenav .= "<li><a href='?".$_con."page=1'>共".$_allcount."条</a></li>";
$_pagenav .= "<li><a href='?".$_con."page=$_pre_page'>&laquo;</a></li> ";
$_page_show_start = (ceil($_page/$_page_show)-1)*$_page_show;
$_page_show_str = '';
if($_page_show>$_page_count){
	$_page_show = $_page_count;
}
for($j=1;$j<=$_page_show;$j++){
	$_page_show_now = $_page_show_start+$j;
	if($_page==$_page_show_now){
		$_page_show_str .= "<li class='active'><a href='?".$_con."page=$_page_show_now'><strong>$_page_show_now</strong></a></li>";
	}else{
		$_page_show_str .= "<li><a href='?".$_con."page=$_page_show_now'>$_page_show_now</a></li>";
	}
}
$_pagenav.=$_page_show_str;
$_pagenav .= "<li><a href='?".$_con."page=$_next_page'>&raquo;</a></li>";
$_pagenav .= "<li><a href='?".$_con."page=$_page_count'>末页</a></li>";
echo $_pagenav;
?>  
</ul>
<?php 
	require ROOT_PATH.'includes/close.inc.php';
?>  
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

 效果图:


admin.php

<?php 
	define('IN_TG',true);
	require dirname(__FILE__).'/includes/common.inc.php';
	require ROOT_PATH.'includes/type.func.php';
	$_type_arr = _type();
	$_info_type = _info_type();
	$_page=$_GET['page'];
	$_search = trim($_GET['search']);
	if($_page == null || $_page<=0){
		$_page =1;
	}
	if($_GET['oid']!=null){
		$_oid = $_GET['oid'];
		$_sql = "UPDATE o_code SET o_out = '1' WHERE o_id = $_oid LIMIT 1";
		_query($_sql);
	}
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<meta name="robots" content="noindex,nofollow">
<title>管理</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body {font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif;}
</style>
</head>
<body style="margin: 10px;">

 <form action="admin.php" method="get">
	<div class="input-group">
		<input type="text" class="form-control" name="search" value="<?php echo $_search ?>">
		<span class="input-group-btn">
			<button class="btn btn-primary" type="submit">搜索</button>
			<a class="btn btn-info" href="add.php" target="_blank">新增</a>
		</span>
	</div>
</form>
<br>
<table class="table table-striped table-hover"> 
	<thead>
		<tr>
			<th>单词</th>
			<th>音标</th>
			<th>说明</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
<?php
	$_page_show =3;//最大显示3页
	$_page_size =50;//显示每页的条数
	if($_page == null || $_page<=0){
		$_page =1;
	}
	$_page_begin = ($_page-1) * $_page_size;
	$_sql_list = "SELECT * FROM o_code WHERE o_out='0' ";
	if($_search !=null){
		$_sql_list.= "AND o_english LIKE '%$_search%' order by o_time DESC LIMIT $_page_begin , $_page_size";
	}else{
		$_sql_list.= "order by o_time DESC LIMIT $_page_begin , $_page_size";
	}
	$_result = _query($_sql_list);
    while (!!$row = mysql_fetch_array($_result)){
?>
		<tr>
			<td><?php echo $row[o_english]?></td>
			<td><?php echo $row[o_symbol]?></td>
			<td><?php echo $_type_arr[$row[o_type]-1]; ?><?php echo $row[o_info]?></td>
			<td><a href="update.php?id=<?php echo $row[o_id];?>" target="_blank">修改</a> <a href="?search=<?php echo $_search;?>&page=<?php echo $_page;?>&oid=<?php echo $row[o_id];?>" onclick="javascript:return confirm('您确定要删除该条数据吗?')"  title="删除该条数据">删除</a></td>
		</tr>
<?php
    }
?>
	</tbody>
</table>
<ul class="pagination pull-right">  
<?php
$_sql_count = "SELECT count( o_id ) FROM o_code WHERE o_out='0' "; 

//获取参数
$_con = '';
if($_search !=null){
	$_sql_count.= " AND o_english LIKE '%$_search%'";
	$_con = "search=$_search&";
}

//分页
$_answers = mysql_fetch_array(_query($_sql_count));
$_allcount= $_answers[0];
$_page_count = ceil($_allcount/$_page_size);
if($_page <= 1 || $_page == '') $_page = 1;
if($_page >= $_page_count) $_page = $_page_count;
$_pre_page = ($_page == 1)? 1 : $_page - 1;
$_next_page= ($_page == $_page_count)? $_page_count : $_page + 1 ;
$_pagenav .= "<li><a href='?".$_con."page=1'>共".$_allcount."条</a></li>";
$_pagenav .= "<li><a href='?".$_con."page=$_pre_page'>&laquo;</a></li> ";
$_page_show_start = (ceil($_page/$_page_show)-1)*$_page_show;
$_page_show_str = '';
if($_page_show>$_page_count){
	$_page_show = $_page_count;
}
for($j=1;$j<=$_page_show;$j++){
	$_page_show_now = $_page_show_start+$j;
	if($_page==$_page_show_now){
		$_page_show_str .= "<li class='active'><a href='?".$_con."page=$_page_show_now'><strong>$_page_show_now</strong></a></li>";
	}else{
		$_page_show_str .= "<li><a href='?".$_con."page=$_page_show_now'>$_page_show_now</a></li>";
	}
}
$_pagenav.=$_page_show_str;
$_pagenav .= "<li><a href='?".$_con."page=$_next_page'>&raquo;</a></li>";
$_pagenav .= "<li><a href='?".$_con."page=$_page_count'>末页</a></li>";
echo $_pagenav;
?> 
</ul>  
<?php 
	require ROOT_PATH.'includes/close.inc.php';
?>  
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

 效果图:

 

add.php

<?php 
	define('IN_TG',true);
	require dirname(__FILE__).'/includes/common.inc.php';
	require ROOT_PATH.'includes/type.func.php';
	$_type_arr = _type();
	$_info_type = _info_type();
	if ($_GET['action'] == 'code') {
		$_english = trim($_POST['english']);
		$_symbol = trim($_POST['symbol']);
		$_info = trim($_POST['info']);
		$_type = trim($_POST['type']);
		$_sql = "INSERT INTO o_code (o_english, o_symbol, o_info, o_time, o_out, o_type) 
				VALUES ('$_english', '$_symbol', '$_info', NOW(), '0', '$_type')";
		_query($_sql);
		_close();
		echo "<script type='text/javascript'>alert('添加成功');location.href='add.php';</script>";
		exit();
	}
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<meta name="robots" content="noindex,nofollow">
<title>添加</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body {font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif;}
</style>
</head>
<body style="margin: 10px;">
<form class="form-horizontal" action="add.php?action=code" method="post">
	<div class="form-group">
		<label class="col-sm-2 control-label">单词</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" id="english" name="english" placeholder="请输入单词">
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">音标</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="symbol" placeholder="请输入音标">
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">说明</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="info" placeholder="请输入说明">
		</div>
	</div>
	<select class="form-control" name="type">
		<?php 
			for($i=0;$i<count($_type_arr);$i++){
				if($i==0){
					echo "<option value='".($i+1)."' selected>$_type_arr[$i] $_info_type[$i]</option>";
				}else{
					echo "<option value='".($i+1)."'>$_type_arr[$i] $_info_type[$i]</option>";
				}
			}
		?>
	</select>
	<br>
	<div class="btn-group pull-right">  
	    <input type="submit" class="btn btn-primary" value="提交">
	    <input type="reset" class="btn btn-info" value="重置">
    </div>
</form>
<div class="clearfix"></div>
<br>
<div class="alert alert-info fade in">  
    <button class="close" data-dismiss="alert">  
        <span>&times;</span>  
    </button>  
    <p id="english_text">该窗口显示代码是否存在</p>  
</div>
<?php 
	require ROOT_PATH.'includes/close.inc.php';
?>  
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
function _id(id){  
    return document.getElementById(id);  
} 

$(function(){ 
	_id("english").onblur = function(){
		english_onblur(this);
	};
});

function english_onblur(obj){
	var english = _id("english");
	var english_text = _id("english_text")
	$.post('includes/code.ajax.php', {
		english : obj.value
	}, function (response, status, xhr) {
		if(response == '存在'){
			english_text.innerHTML= english.value+"在数据库已存在";
		}else{
			english_text.innerHTML= english.value+"可以使用";
		}
	});
}
</script>
</body>
</html>

 

code.ajax.php

<?php
	define('IN_TG',true);
	//引入公共文件
	require dirname(__FILE__).'/common.inc.php'; //转换成硬路径,速度更快
	$_english = $_POST['english'];
	$_sql = "SELECT * FROM o_code WHERE o_english = '$_english ' LIMIT 1";
	$_result = _fetch_array($_sql);
	if($_result){
		echo '存在';
	}
	_close();
?>

效果图:

 update.php

<?php 
	define('IN_TG',true);
	require dirname(__FILE__).'/includes/common.inc.php';
	require ROOT_PATH.'includes/type.func.php';
	$_type_arr = _type();
	$_info_type = _info_type();
	$_id = $_GET['id'];
	if($_GET['id']!=null){
		$_sql = " SELECT * FROM o_code WHERE o_id =$_id LIMIT 1 ";
		$_result = _fetch_array($_sql);
		if ($_GET['action'] == 'code') {
			$_english = trim($_POST['english']);
			$_symbol = trim($_POST['symbol']);
			$_info = trim($_POST['info']);
			$_type = trim($_POST['type']);
			$_sql = "UPDATE o_code SET o_english = '$_english', o_symbol = '$_symbol',
					 o_info = '$_info', o_type = '$_type' WHERE o_id = $_id";
			_query($_sql);
			_close();
			echo "<script type='text/javascript'>alert('修改成功');location.href='update.php?id=$_id';</script>";
			exit();
		}
	}
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<meta name="robots" content="noindex,nofollow">
<title>修改</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body {font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif;}
</style>
</head>
<body style="margin: 10px;">
<form class="form-horizontal" action="update.php?id=<?php echo $_id?>&action=code" method="post">
	<div class="form-group">
		<label class="col-sm-2 control-label">单词</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="english" value="<?php echo $_result[o_english]?>" placeholder="请输入单词">
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">音标</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="symbol" value="<?php echo $_result[o_symbol]?>" placeholder="请输入音标">
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">说明</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="info" value="<?php echo $_result[o_info]?>" placeholder="请输入说明">
		</div>
	</div>
	<select class="form-control" name="type">
		<?php 
			for($i=0;$i<count($_type_arr);$i++){
				if(($i+1)==$_result[o_type]){
					echo "<option value='".($i+1)."' selected>$_type_arr[$i] $_info_type[$i]</option>";
				}else{
					echo "<option value='".($i+1)."'>$_type_arr[$i] $_info_type[$i]</option>";
				}
			}
		?>
	</select>
	<br>
	<div class="btn-group pull-right">  
	    <input type="submit" class="btn btn-primary" value="提交">
	    <input type="reset" class="btn btn-info" value="重置">
    </div>
</form>
<div class="clearfix"></div>
<br>
<div class="alert alert-info fade in">  
    <button class="close" data-dismiss="alert">  
        <span>&times;</span>  
    </button>  
    <p>你现在对编号 <strong><?php echo $_result[o_id]?></strong> 的 <strong><?php echo $_result[o_english]?></strong> 单词进行修改</p>  
</div>
<?php 
	require ROOT_PATH.'includes/close.inc.php';
?>    
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

效果图:

 


 

  • 大小: 15.4 KB
  • 大小: 9 KB
  • 大小: 9.1 KB
  • 大小: 17.8 KB
2
1
分享到:
评论

相关推荐

    PHP增删改查登录注册

    在“PHP增删改查登录注册”这个实例中,我们将探讨PHP如何与MySQL数据库进行交互,实现基本的用户管理功能。 **1. PHP基础知识** PHP嵌入到HTML中,用于动态生成网页内容。它支持多种数据类型,如字符串、整型、...

    基于面向对象分层思想的PHP增删改查demo

    在这个"基于面向对象分层思想的PHP增删改查demo"中,我们可以看到如何将这一思想应用于实际的Web应用开发。 首先,"分层思想"是将一个复杂的系统分解为多个独立的层次,每个层次负责不同的职责。常见的三层架构包括...

    PHP 增删改查

    本文将深入探讨PHP与MySQL结合时进行数据操作的关键知识点——增删改查(CRUD)。 一、创建(Create) 在PHP中创建新数据涉及向MySQL数据库发送SQL INSERT语句。首先,你需要连接到数据库,使用`mysqli_connect`或...

    PHP增删改查模板(原生PHP+BootStrap前端框架)

    涵盖php增删改查的所有操作,并按照java的mvc设计模式写的(只是没写service,但dao层和controller,pojo,dbhelper还是有写的) 需要自己建立一个login表,有id(int auto_increment PK),user(varchar),pwd(varchar) 这三个...

    PHP增删改查

    PHP增删改查详解 PHP增删改查是PHP编程语言中最基本也是最重要的四个操作。它们分别是Create(增)、Read(读)、Update(改)和Delete(删)。在这个资源中,我们将学习如何使用PHP语言实现这些操作。 增(Create...

    php增删改查实例

    "PHP增删改查实例"是基于PHP实现的数据库操作的基本功能,包括添加(Add)、删除(Delete)、修改(Update)和查询(Select),这些都是Web应用中最基础且重要的部分。这个实例是为了管理实验室工位学生信息而设计的...

    简易php增删改查demo

    这个"简易php增删改查demo"是一个针对初学者的教程,旨在教授如何使用PHP与MySQL数据库进行交互,实现基本的数据操作:增加(Add)、删除(Delete)、修改(Modify)和查询(Query)。下面我们将深入探讨这些知识点...

    最简单的PHP增删改查案例

    本文将基于"最简单的PHP增删改查案例"这一主题,深入探讨PHP如何与数据库交互,实现数据的添加(Add)、删除(Delete)、修改(Update)和查询(Select)功能。这些基本操作是任何Web应用的基础,对初学者而言尤为...

    使用php实现数据库增删改查

    使用 PHP 实现数据库增删改查 本文将详细介绍使用 PHP 实现数据库增删改查的方法,并结合实际代码示例,讲解数据库连接、增删改查操作的步骤和实现细节。 数据库连接 在使用 PHP 实现数据库增删改查之前,需要先...

    php增删改查

    php是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域。PHP 独特的语法混合了C、Java、Perl以及PHP自创的语法。它可以比CGI或者Perl更快速地执行动态网页。用...

    tongxunlu.rar_php 增删改查_php增删改查_php增删查改_php通讯录

    【标签】中列出的"php_增删改查"、"php增删改查"、"php增删查改",虽然存在重复,但都强调了这个项目涉及的PHP数据库操作技术。"php通讯录"则表明这个项目专注于创建一个管理个人或组织联系信息的应用。 【压缩包子...

    PHP增删改查登录注册_pnljxh_php_

    标题 "PHP增删改查登录注册_pnljxh_php_" 暗示这是一个关于使用PHP编程语言实现基本的数据库操作和用户管理系统的教程。PHP(Hypertext Preprocessor)是一种广泛使用的开源脚本语言,尤其适用于Web开发,能够嵌入到...

    php+mysql简单增删改查 案例

    php+mysql简单增删改查,配置好数据库连接地址直接导入运行php即可,

    我写的简单的php增删改查程序

    这个名为“我写的简单的php增删改查程序”的项目,显然是一个学习PHP基础操作的实践案例,主要涵盖了数据库交互的基本操作:增(添加数据)、删(删除数据)、改(修改数据)和查(查询数据)。下面我们将详细探讨...

    Php操作txt文件类库实现增删改查

    "Php操作txt文件类库实现增删改查" 提供了一个方便的工具,使得通过PHP对TXT文档进行数据管理变得简单高效。 这个类库的主要目标是模拟数据库的基本操作,如增(添加数据)、删(删除数据)、改(修改数据)和查...

    小白利用PHP+MYSQL+HTML做的期末小项目,实现后台与前端的连接,实现了增删改查功能,美化做的不好大家勿喷,还请多多指正

    用的是以前模仿做的HTML淘宝网静态页面,接连上数据库加入图片和信息,实现后台与前端的连接,实现了增删改查功能美化做的不好还请大家勿喷。呜呜呜,做了很久也只能实现这样一个效果了,要是有大神希望帮帮我改改...

    php增删改查操作实例详解

    &lt;?php $linkID=@mysql_connect("localhost","root","123456"); if(!$linkID){ echo "没连接上"; } $ss=@mysql_select_db("bean"); if(!$ss){ echo "没找到数据库"; } $id = $_POST['id']; $name = $_POST['name'];...

    bootstrap 带增删改查 表格

    在Bootstrap中,表格设计简洁,适应性强,尤其适合在网页上实现数据的增删改查功能。Bootstrap表格通常结合JavaScript库如jQuery和相关的插件(如jqGrid)来增强交互性,提供分页、搜索、排序等高级功能。 ...

    简单html增删改查

    在HTML中,增删改查通常指的是对网页上动态数据的管理,虽然HTML本身不具备动态功能,但可以通过与其他技术如JavaScript、AJAX或服务器端语言(如PHP、Python等)结合来实现。下面将详细介绍这些概念: **增(Add)...

Global site tag (gtag.js) - Google Analytics