简单连接mysql,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 '
';
$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)