简单连接mysql,php语句手写
2011-10-24 01:23
274 查看
<?php
header('Content-Type: text/html; charset=utf-8');
$db=mysql_connect('localhost','qqtxt','zhh1981zhh');
if($db)
{
mysql_query("SET character_set_connection=utf8, character_set_results=utf8,character_set_client=binary");
mysql_select_db('a') or die('select_db failed');
set_magic_quotes_runtime(0);
//ini_set('magic_quotes_runtime','off');
echo $temp='update a set a=a中\国c where id=1'; echo '<br/>';
$result = mysql_query('update a set a="a中aaa国c" where id=1') or die('Query failed: ' . mysql_error());
$query = 'select * from a where id=1';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($row=mysql_fetch_array($result))
{
echo $row['a'];
}
//echo get_magic_quotes_runtime( );
}
?>
header('Content-Type: text/html; charset=utf-8');
$db=mysql_connect('localhost','qqtxt','zhh1981zhh');
if($db)
{
mysql_query("SET character_set_connection=utf8, character_set_results=utf8,character_set_client=binary");
mysql_select_db('a') or die('select_db failed');
set_magic_quotes_runtime(0);
//ini_set('magic_quotes_runtime','off');
echo $temp='update a set a=a中\国c where id=1'; echo '<br/>';
$result = mysql_query('update a set a="a中aaa国c" where id=1') or die('Query failed: ' . mysql_error());
$query = 'select * from a where id=1';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($row=mysql_fetch_array($result))
{
echo $row['a'];
}
//echo get_magic_quotes_runtime( );
}
?>
相关文章推荐
- PHP连接MYSQL实现简单的无限极分类
- PHP简单mysql管理工具,支持执行多条mysql语句!
- 简单php_mysql框架之一_1_PDO连接与测试
- php mysql连接语句不能一点一点拼接字符串,要当做整体来拼接
- PHP简单mysql管理工具,支持执行多条mysql语句!
- PHP简单mysql管理工具,支持执行多条mysql语句!
- php与mysql建立连接并执行SQL语句的代码
- php中mysql连接和基本操作代码(快速测试使用,简单方便)
- php中mysql语句中如果有变量,该如何连接字符串
- php操作mysql数据库的连接语句以及最简单的增删改查语句
- php操作Mysql简单介绍:连接mysql|打开数据库|查询|关闭mysql
- asp.net连接MYSQL的SQL语句中有汉字问题最简单、最终的解决方法
- 《PHP---mysql数据连接简单示例》
- PHP MYSQL 使用 PDO 连接数据库并执行 SQL 语句
- PHP连接mysql的简单登录
- PHP连接MySQL数据库;mysql中update批量修改与替换语句
- php与mysql建立连接并执行SQL语句的代码
- PHP 连接mysql进行简单的数据操作
- php PDO连接时,提示"unknown mysql server host"