Can anyone help me figure out what is wrong with this code?

后端 未结 4 797
别跟我提以往
别跟我提以往 2021-01-24 22:24


        
相关标签:
4条回答
  • 2021-01-24 23:16

    It's telling you the $_POST values you're referencing do not exist. Are you submitting a form to this page? If so, make sure you check your form field names. If not - this script needs a form submitting to it.

    0 讨论(0)
  • 2021-01-24 23:17

    Either the POST doesn't contain the variables in question, or you aren't performing a POST in the first place.

    0 讨论(0)
  • 2021-01-24 23:20

    These lines cause the "undefined index" warnings.

    $username = $_POST['user_name'];
    $password = $_POST['password'];
    $type = $_POST['user_type'];
    

    When you submit a form to this script, $_POST is an array containing all the form elements. In your case the user_name, password and user_type form elements did not exist, or you did not submit a form. Thus, the array elements do not exist. When you try to read from a nonexistant array element, you get the "Undefined Index" notice.

    The other warning is caused by this line:

    $count = mysql_numrows($info);
    

    You're passing $info, an array, to mysql_numrows. You should be passing it a result resource from a mysql_query. You should be passing $data to mysql_numrows.

    0 讨论(0)
  • 2021-01-24 23:23

    try:

    $count = mysql_numrows($data);
    

    it says you're passing the mysql_numrows an array when it expects a resource.

    0 讨论(0)
提交回复
热议问题