小编Yu *_*Son的帖子

无法在未调用Looper.prepare()3的线程内创建处理程序

public class AddStudentActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_student);
}

public void add2(View view){
    //create 3 editText  ,  1 Textview
    EditText et_name, et_age;
    RadioButton rb_male;
    TextView tv_msg;

    //bind with xml widget
    et_name = (EditText)findViewById(R.id.et_name);
    et_age = (EditText)findViewById(R.id.et_age);
    rb_male = (RadioButton)findViewById(R.id.rb_male);
    tv_msg = (TextView)findViewById(R.id.tv_msg);
    //retrieve values
    String name = et_name.getText().toString();
    String age = et_age.getText().toString();
    String gender = "";
    if (rb_male.isChecked())
        gender = "male";
    else
        gender = "female";
    //call php
    new AddStudent(this, tv_msg).execute(name, age, gender);
   }
} …
Run Code Online (Sandbox Code Playgroud)

android ui-thread toast

5
推荐指数
1
解决办法
4803
查看次数

mysql访问被用户''@ localhost'拒绝访问数据库''

这是我在config.php中的当前代码:

mysql_connect("localhost","roof") or die(mysql_error());
mysql_select_db("tarclibrary") or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)

这是我在register.php中的当前代码:

require('config.php');

if(isset($_POST["submit"])){

//Perform the verification of the nation
$email1 =$_POST['email1'];
$email2 =$_POST['email2'];
$pass1 =$_POST['pass1'];
$pass2 =$_POST['pass2'];

if($email1 == $email2){
    if($pass1 == $pass2){
        //All good.carry on

        $fname = mysql_real_escape_string($_POST['fname']);
        $lname = mysql_real_escape_string($_POST['lname']);
        $uname = mysql_real_escape_string($_POST['uname']);
        $pass1 = mysql_real_escape_string($pass1);
        $pass2 = mysql_real_escape_string($pass2);
        $email1 = mysql_real_escape_string($email1); 
        $email2 = mysql_real_escape_string($email2);

        $pass1= md5($pass1);

        $sql = mysql_query("SELECT * FROM 'users' WHERE 'uname' = '$uname'");
        if(mysql_num_rows($sql) > 0){
            echo "Sorry, that user already exits";
            exit();
        }

        mysql_select_db('library') or die(mysql_error()); …
Run Code Online (Sandbox Code Playgroud)

php mysql

-3
推荐指数
1
解决办法
2119
查看次数

标签 统计

android ×1

mysql ×1

php ×1

toast ×1

ui-thread ×1