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 ...
随机推荐
- tomcat的server.xml配置及context配置直接引用工程
server.xml配置简介 下面是这个文件中的基本配置信息,更具体的配置信息见tomcat的文档 server: port 指定一个端口,这个 ...
- GNU风格 ARM汇编语法2
.GNU汇编程序中的标号symbol(或label) 标号只能由a-z,A-Z,-,".",_等(由点.字母.数字.下划线等组成,除局部标号外,不能以数字开头)字符组成. Symb ...
- mproxy: c 语言实现的一个最小的http代理,支持FQ
https://github.com/examplecode/mproxy mproxy 使用说明 这是一个微型的http代理服务器实现,使用c语言实现,核心代码量不足500行,不依赖任何第三方的库( ...
- 【WPF】BusyIndicator做Loading遮罩层
百度了一下,粗略看了几个国内野人的做法,花了时间看下去感觉不太好用(比如有Loading居然只是作为窗体的一个局部控件的,没法全屏遮罩,那要你有何用?),于是谷歌找轮子去. 好用的轮子:http:// ...
- 关于JXL读写以及修改EXCEL文件<转>
首先引用网上的文章,谈谈JXL与POI的区别 POI为apache公司的一个子项目,主要是提供一组操作windows文档的Java API. Java Excel俗称jxl是一开放源码项目,通过它Ja ...
- contiki bsp
1 lpc1768 git clone https://github.com/bolandi/contiki.git 2 efm32 git clone https://github.com/ ...
- 【大数据笔记】白话详解Zookeeper的一致性
下面内容主要摘抄于<<Hadoop实战>>,红色高亮部分是本人添加的白话注释. Zookeeper 是一种高性能.可扩展的服务. Zookeeper 的读写速度非常快,并且读的 ...
- web工程jar包问题
JRE System Library主要存放J2SE的标准jar,一般不需要调整. Referenced Libraries是存放第三方的jar包,也就是自己导入的jar包.在项目属性的Java Bu ...
- 有趣的 Mysql 存储引擎
Mysql 提供了一套统一的应用开发模型和核心 API,因此,尽管不同的存储引擎拥有不同的特性,不过对于开发人员,应用操作都是完全透明的.应用层的连接并不直接访问存储引擎层,而是访问 Mysql 提供 ...
- javascript实现记录文本框内文字个数
最近在做一个项目中遇到这样一个问题,要对文本框中用户输入的文字进行记数,在下面显示出来,因为我们做的是一个短信发送平台,现在我们国家的短信服务,如果你的信息超过了70个字符,短信就会按二条给你下发.所 ...