$query = "SELECT *
FROM users
WHERE username = '".mysql_escape_string($username)."'
AND password = '".mysql_escape_string($password)."'";
$result = mysql_fetch_array(mysql_query($query));
Run Code Online (Sandbox Code Playgroud)
现在这是我对一般访问者的查询,现在如果我需要管理员和主持人,我如何从具有特定ID的相同用户处理.
我的SQL查询.
CREATE TABLE IF NOT EXISTS `users` (
`yourID` int(10) unsigned NOT NULL auto_increment,
`username` varchar(26) collate latin1_general_ci NOT NULL,
`password` varchar(26) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`yourID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=87992 ;
Run Code Online (Sandbox Code Playgroud)
管理员和管理员的登录页面将相同.
$result = mysql_query("SELECT * FROM project ORDER BY projectid");
while($row = mysql_fetch_array($result))
{
return(array($row['projectid'], $row['clientname'],
$row['salesperson'], $row['prospect']));
}
Run Code Online (Sandbox Code Playgroud)
我只从字段中获得第一组值.我需要所有的价值观.
如何使用PHP从LDAP获取所有用户.
function getUsers() {
$process = new process();
//ldap->s_Host('domain.com');
//$ldap->s_Domain('domain.com');
$process->s_Host('domain.com');
$process->s_Domain('domain.com');
$process->s_LdapSecure(false);
if($process->LdapConn()){
if($process->LdapBind()){
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个需要传递的项目列表,应该删除.我怎么能用PHP做到这一点?
$query = "DELETE from members WHERE member_id ='$chan[2]' ";
Run Code Online (Sandbox Code Playgroud)
$chan[2] 包含多个值,但只删除一个值.
以下SQL查询有什么问题?
$sql="SELECT * FROM ".TABLE." WHERE desgid='$id', weightid='$weightid' AND deptid='$deptid' ";
Run Code Online (Sandbox Code Playgroud)
错误消息是:
您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在第1行'weightid ='12'和deptid = '31''附近使用正确的语法
我有一个XML,它有一个属性选项或组合框,解析我需要动态地在我的flex中创建组件.
Viatropos给出了一个很棒的代码,但是我无法执行它...任何人都可以生成它...谢谢
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
Log.d("Does", "get called");
inflater.inflate(R.menu.menuitem, menu);
super.onCreateOptionsMenu(menu, inflater);
}
Run Code Online (Sandbox Code Playgroud)
下面是我的onCreateView方法,我正在调用
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
return inflater.inflate(R.layout.layout1, container, false);
}
Run Code Online (Sandbox Code Playgroud)
我没有在我的操作栏中获取日志语句或菜单.
更新:我尝试从片段的onCreate方法调用它,但菜单未显示.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
Run Code Online (Sandbox Code Playgroud)
menu.xml文件
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/section" android:title="@string/section"
android:icon="@drawable/ic_section"
android:showAsAction="always" />
<item android:id="@+id/refresh" android:title="@string/refresh"
android:icon="@drawable/ic_refresh"
android:showAsAction="always" />
<item android:id="@+id/edit_patient" android:title="@string/edit_patient"
android:icon="@drawable/ic_editpatient"
android:showAsAction="always" />
<item android:id="@+id/about" android:title="@string/about"
android:showAsAction="never" />
<item android:id="@+id/help" android:title="@string/help"
android:showAsAction="never" />
<item android:id="@+id/signout" android:title="@string/signout"
android:showAsAction="never" …Run Code Online (Sandbox Code Playgroud) HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(URL);
try {
StringEntity documentStringified = new StringEntity(Obj.toString());
httpPost.setEntity(documentStringified);
} catch (UnsupportedEncodingException e) {
Log.d("UnsupportedEncodingException", e.toString());
}
try {
HttpResponse response = httpClient.execute(httpPost);
Log.d("Response", response.toString());
} catch (IOException e) {
Log.d("IOException", e.toString());
}
Run Code Online (Sandbox Code Playgroud)
我无法得到response.如何打印响应Logger or console. response.toString()或response.getEntity.toString()不起作用.
我应该将Content-type设置为"application/json".
https://github.com/jfeinstein10/SlidingMenu
我正在使用这个库,我想在我打开一个新的时隐藏滑动菜单activity,这样当我按回来时我不希望滑动菜单出现.
@Override
public void onListItemClick(ListView lv, View v, int position, long id) {
switch (position) {
case 0:
Intent intent = new Intent("android.intent.action.Home");
getActivity().startActivity(intent);
break;
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码在我的SherlockListFragment班级,我想隐藏滑动菜单,一旦我开始一个新的活动.
$result = mysql_query("INSERT INTO project (clientname, salesperson, prospect)
VALUES ('$clientName','$salesPer','$prospectVal')");
while ($row = mysql_fetch_assoc($result)) {
$projectID = $row['projectid'];
return $projectID;
}
Run Code Online (Sandbox Code Playgroud)
我没有从数据库中获取projectID.字段名称是动态名称,在每次插入时递增.