php中一些常用的语句收集
清空数据表 truncate 表名;
http://blog.knowsky.com/234205.htm 常用的SQL语句实例
http://blog.csdn.net/vericlongmore/article/details/7431029 php mysql数据库常用sql语句命令集合
http://www.banghui.org/10064.html PHP新手必学的常用SQL语句 数据库
http://blog.163.com/lgh_2002/blog/static/440175262007102511246481/ SQL语句大全
*替换数据库敏感词*
把"北京"替换成"南京'
update jinsha_category set catname=replace(catname,'北京','南京');
要求:
一个字段值:
………………预约…………
要将其中 “预约”,改成“预定”。
但是我开始写的时候,写成了
- update ..set smscontent = replace ('预约','预定')
1:连接数据库:
<?php
$conn = mysql_connect("localhost","root","www.xunjobs.com") or die("数据库连接失败".mysql_error());
mysql_select_db("db_pursey",$conn) or die("数据库访问失败".mysql_error());
mysql_query("set names gb2312");
?>
2:插入数据:
<?php
include("conn/conn.php");
$type=$_POST[type];
$title=$_POST[title];
$content=$_POST[content];
$linkman=$_POST[linkman];
$tel=$_POST[tel];
//$edate=date("Y-m-d h:i:s");获得系统日期
$edate=date("Y-m-d H:i:s");
$sql=mysql_query("insert into tb_info(type,title,content,linkman,tel,checkstate,edate) values('$type','$title','$content','$linkman','$tel',0,'$edate')");
if($sql){
//php中输出<script>语句的方法
echo "<script>alert('恭喜您,信息发布成功!');window.location.href='release.php';</script>";
}else{
echo "<script>alert('对不起,信息发布失败!');history.back();</script>";
}
?>
3:查询数据
<?php
include("conn/conn.php");
$type=$_POST[type];
$content=$_POST[content];
$sql1=mysql_query("select * from tb_leaguerinfo where checkstate=1 and type='$type' and (content like'%$content%' or title like'%$content%' or linkman like'%$content%' or tel like'%$content%')");
$info1=mysql_fetch_array($sql1);
$sql=mysql_query("select * from tb_info where checkstate=1 and type='$type' and (content like'%$content%' or title like'%$content%' or linkman like'%$content%' or tel like'%$content%')");
$info=mysql_fetch_array($sql);
?>
<?php
if($info1){
do{
?>
<table width="540" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26">『<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info1[type]);?>』 <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info1[title]);?> <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info1[edate]);?></td>
</tr>
<tr>
<td height="26"> <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info1[content]);?></td>
</tr>
<tr>
<td height="26"> 联系人:<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info1[linkman]);?> 联系电话:<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info1[tel]);?></td>
</tr>
<tr>
<td height="3" background="Images/line1.gif"></td>
</tr>
</table>
<?php
}while($info1=mysql_fetch_array($sql1));
?>
</td>
</tr>
<tr>
<td height="140" align="center" valign="top"> <br>
<?php
if($info){
do{
?>
<table width="540" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26">『<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[type]);?>』 <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[title]);?> <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[edate]);?></td>
</tr>
<tr>
<td height="26"> <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[content]);?></td>
</tr>
<tr>
<td height="26"> 联系人:<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[linkman]);?> 联系电话:<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[tel]);?></td>
</tr>
<tr>
<td height="3" background="Images/line1.gif"></td>
</tr>
</table>
<?php
} while($info=mysql_fetch_array($sql));
}
}else{
?>
<?php
if($info){
do{
?>
<table width="540" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26">『<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[type]);?>』 <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[title]);?> <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[edate]);?></td>
</tr>
<tr>
<td height="26"> <?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[content]);?></td>
</tr>
<tr>
<td height="26"> 联系人:<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[linkman]);?> 联系电话:<?php echo str_ireplace($content,"<font color='#FF0000'>".$content."</font>",$info[tel]);?></td>
</tr>
<tr>
<td height="3" background="Images/line1.gif"></td>
</tr>
</table>
<?php
} while($info=mysql_fetch_array($sql));
}else{
?>
<table width="540" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">您检索的信息资源不存在!</td>
</tr>
</table>
<?php
}
}
?>
转自:http://blog.csdn.net/aerchi
php中一些常用的语句收集的更多相关文章
- Oracle系统表整理+常用SQL语句收集
欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...
- awk在企业中最常用的语句
awk最常用以及面试基本都会被问到的实例: A.统计日志中每个URL被访问的次数 cat access.log http://www.etiantian.org/1.html http://post. ...
- Oracle系统表整理+常用SQL语句收集(转载)
原文:https://www.cnblogs.com/jiangxinnju/p/5840420.html-- DBA/ALL/USER/V_$/GV_$/SESSION/INDEX开头的绝大部分都是 ...
- sql 2008常用语法语句收集
EXEC sp_dropuser 'test' : 从当前数据库删除用户 test EXEC sp_droplogin 'test' : 从 SQL Server 中删除登录 test select ...
- from selenium.webdriver.chrome.options import Options中add_argument 常用参数表收集
chrome_options.add_argument("xxx") 序号 参数 说明 1 --allow-outdated-plugins 不停用过期的插件. 2 --allow ...
- MySQL 存储过程常用SQL语句收集
1,select curdate() /*2016-10-08*/ 2,select date_sub(curdate(), INTERVAL 6 DAY) /*2016-10-02*/ 3,case ...
- ios中常见数据存储方式以及SQLite常用的语句
在iOS中,根据不同的需求对应的有多种数据存储方式: 1.NSUserdefaults 将数据存储到沙盒中(library),方便易用,但是只能存储系统提供的数据类型(plist),不能存储自定义的 ...
- mysql中常用的语句整理
mysql中常用的语句: 1:创建带自增长的主键的表 DROP TABLE IF EXISTS user_login ; CREATE TABLE user_login ( user_id INT ...
- Lua中的常用语句结构以及函数
1.Lua中的常用语句结构介绍 --if 语句结构,如下实例: gTable = {} ] ] then ]) == gTable[] then ]) else print("unkown ...
随机推荐
- 每日英语:Why Food Companies Are Fascinated by the Way We Eat
Are you a cruncher? Or a 'smoosher'? cruncher:咬嚼者,咬碎 Some people crave the perfectly crispy crunch o ...
- nyoj 715 Adjacent Bit Counts
描述 For a string of n bits x1, x2, x3, …, xn, the adjacent bit count of the string is given by ...
- {{ }} 和ng-bind
花括号最后会转换成ng-bind,在一次加载数据的时候,显示花括号,所以使用ng-bind 或者ng-bind-html
- 使用寄存器点亮LED——前言基础知识
在点亮LED之前,我们需要具备一些基础知识: GPIO—general purpose intput output 是通用输入输出端口的简称,简单来说就是软件可控制的引脚,STM32芯片的GPIO引脚 ...
- silverlight调用WebService传递json接收绑定数据
1.接收数据: WebService通过接口接收数据.类型为object 2.类型转换: 通过json转换方法将object转换为json格式数据 3.调用WebService方法: silverli ...
- 按关键字搜索自己的CSDN博客
CSDN居然没有搜索自己博客的功能!如果博客写多了后将很难查找. 搜到的办法居然要靠谷歌... 在谷歌输入关键词,格式如下: <要检索的关键词> site:blog.csdn.net/&l ...
- buildroot 使用本地交叉编译器记录
继上一次glibc bug 事件后,剑锋就说文件系统要用统一的交叉编译器.所以今天就试了一下,便记录一下 在官网下载干净的 buildroot 进入解压后的 buildroot 目录 步骤: make ...
- CentOS安装redmine 2后的简单配置
CentOS5.4安装redmine详细步骤 http://blog.csdn.net/leekwen/article/details/8516832 <<<<输出日志的配置& ...
- 删除TP数据库缓存
删除 /Runtime/Data/_fields/ 缓存表文件
- iOS边练边学--UITableViewCell的常见属性设置
// 取消选中的样式(常用) 让当前 cell 按下无反应 cell.selectionStyle = UITableViewCellSelectionStyleNone; // 设置选中的背景色,U ...