我的userajax.php代码
<?php
$username = $_POST['username'];
include('config.php');
include('db.php');
$db = new db();
$db->connect($db_config);
$sql = 'select id,true_name from users where user_type = 1 and true_name like "%'.$username.'%"';
//echo $sql;exit();
$rs = mysql_query($sql);
$html = '<select name="user_id" style="width:100px;padding:5px;">';
$html .= '<option value="0">请选择客户</option>';
while (@$row=mysql_fetch_array($rs)) {
$html .= "<option value=".$row['id'].">".$row['true_name']."</option>";
}
$html .= '</select>';
echo $html;
?>
<?php
$username = $_POST['username'];
include('config.php');
include('db.php');
$db = new db();
$db->connect($db_config);
$sql = 'select id,true_name from users where user_type = 1 and true_name like "%'.$username.'%"';
//echo $sql;exit();
$rs = mysql_query($sql);
$html = '<select name="user_id" style="width:100px;padding:5px;">';
$html .= '<option value="0">请选择客户</option>';
while (@$row=mysql_fetch_array($rs)) {
$html .= "<option value=".$row['id'].">".$row['true_name']."</option>";
}
$html .= '</select>';
echo $html;
?>
解决方案 »
- 怎样获取最近几天或者最近仿问的几条记录
- 问一个问题,php cms Joomla和Drupal哪一个好些?
- 请问使用ucenter可以统一管理多个ecshop网站的注册用户吗?就是使用同一个域名,按照地域不同或者功能不同,分别用ecshop建站,注册用户中心只有一个,
- 请大家进来讨论下,windows 系统下 nginx+php 是怎么解决并发访问问题的?
- ucenter的头像上传camera.swf,怎么让头像的长宽固定比例呢?
- thinkphp3.1 与frameset的显示问题
- 请教perl脚本批量上传大文件然后php获取上载文件地址
- 遇到一个很奇怪的discuz问题,不知道你们有没有遇到过?
- 急!!在租用空间里用phpMyAdmin插入的中文在页面上用utf-8读出来为什么是乱码?
- 招一名兼职PHP程序员(北京)
- iframe弹出页面, 所有session丢失
- 关于$_SERVER['REQUEST_TIME']的疑问
检查过了。 都是gbk 。 我以前用过一个函数改好过。但是我忘记是那个函数了
$_POST['username']=iconv("UTF-8","gbk",$_POST["username"]);
我把ajax这样处理就可以了