49 thoughts on “4. Android PHP MySQL Tutorial | User Registration PHP Script

  • February 24, 2019 at 20:21
    Permalink

    {"error":true,"message":"It seems you are already registered, please choose a different email or username"}

    This one comes!! Even if they are not registered!!!
    What's the problem?

  • February 24, 2019 at 20:21
    Permalink

    help !!

    Fatal error: Uncaught Error: Call to a member function bind_param() on bool in C:xampphtdocsandroidtestconnectserverincludesDbOperations.php:15 Stack trace: #0 C:xampphtdocsandroidtestconnectserverv1registerUser.php(20): DBOperations->createUser('admin1', 'admin1@hotmail….', 'admin1') #1 {main} thrown in C:xampphtdocsandroidtestconnectserverincludesDbOperations.php on line 15

    Thank !!

  • February 24, 2019 at 20:21
    Permalink

    if you have same problem about $conn->prepare or $stmt->bind_param, i have any argument (modify)

    <?php

    class DbOperations {

    // private $con;

    function _construct() {

    }

    // function connect() {
    // require_once dirname(_FILE_) . '/DbConnect.php';
    // $db = new DbConnect();
    // $this->con = $db->connect();
    // }
    //
    // /* CRUD -> C -> CREATE */

    function createUser($username, $pass, $email) {

    $password = md5($pass);
    // $stmt = $this->con->prepare("INSERT INTO `users` (`id`, `username`, `password`, `email`) VALUES (NULL, ?, ?, ?);");
    // $stmt->bind_param("sss",$username,$pass,$email);
    //
    // if ($stmt->execute()) {
    // return true;
    // } else {
    // require false;
    // }
    $DB_HOST = "localhost";
    $DB_USER = "root";
    $DB_PASSWORD = "";
    $DB_NAME = "android";

    // Create connection
    $conn = new mysqli($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME);

    // Check connection
    if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
    }

    // prepare and bind
    $stmt = $conn->prepare("INSERT INTO `users` (`id`, `username`, `password`, `email`) VALUES (NULL, ?, ?, ?);");
    $stmt->bind_param("sss", $username, $pass, $email);
    if ($stmt->execute()) {
    return true;
    } else {
    require false;
    }
    }

    }

    ?>

  • February 24, 2019 at 20:21
    Permalink

    while running the register.php the below error occurs. kindly guide me sir.
    <br />
    <b>Fatal error</b>: Uncaught Error: Call to a member function prepare() on null in C:xampphtdocsAndroidIncludesDbOperations.php:21
    Stack trace:
    #0 C:xampphtdocsAndroidv1registerUser.php(21): DbOperations-&gt;createUser('sid', '1234', 'sid@gmail.com')
    #1 {main}
    thrown in
    <b>C:xampphtdocsAndroidIncludesDbOperations.php</b> on line
    <b>21</b>
    <br />

  • February 24, 2019 at 20:21
    Permalink

    sir I use the source code of the PHP from your link, and when I register user using postman post It reply {"error":true,"message":"Some error occurred please try again"}

    I already follow your video but it keeps on giving me that error

  • February 24, 2019 at 20:21
    Permalink

    one thing is display the one warning also warning</b>: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known. in
    <b>F:xampphtdocsandroidincludesDbConnect.php</b> on line
    <b>13</b>
    what is this sir, means my host name is not found or what?

  • February 24, 2019 at 20:21
    Permalink

    sir,i insert the value in the body of postman but ,
    i m having this error ::{"error":true,"message":"required fields are missing"} please answer me how i solve this problem as soon as possible

  • February 24, 2019 at 20:21
    Permalink

    sir,i insert the value in the body of postman but ,
    i m having this error ::{"error":true,"message":"required fields are missing"} please answer me how i solve this problem as soon as possible

  • February 24, 2019 at 20:21
    Permalink

    hai i want to ask something why my postman when i send is wtite like this syntax error, unexpected 'function_construct' (T_STRING), expecting function (T_FUNCTION) or con ca help me ?

  • February 24, 2019 at 20:21
    Permalink

    Fatal error: Call to a member function bind_param() on boolean in DbOperations.php on line 18 This error is coming.. anyone can help??

  • February 24, 2019 at 20:21
    Permalink

    I Got Error
    Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in C:webhtdocsAndroidincludesdbOperations.php:16 Stack trace: #0 C:webhtdocsAndroidv1registerUser.php(19): dbOperations->createUser(
    .
    .
    Why?

  • February 24, 2019 at 20:21
    Permalink

    Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in C:xampphtdocsandroidincludeDbOperation.php on line 9 help me to solve this error

  • February 24, 2019 at 20:21
    Permalink

    Object not found!
    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

    If you think this is a server error, please contact the webmaster.

    Error 404
    localhost
    Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4
    plz help me to solve this……
    i will be very thankfull to you for this

  • February 24, 2019 at 20:21
    Permalink

    Sir i got error , please help me

    Fatal error: Cannot redeclare class DbConnect in C:xampphtdocsandroidincludeDbConnect.php on line 5

  • February 24, 2019 at 20:21
    Permalink

    Sir I amgetting tis error "Your browser sent a request that this server could not understand.
    Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request..
    "

  • February 24, 2019 at 20:21
    Permalink

    How can i connect this app to my database online at godaddy? Your code/app works on my localhost (local machine), but when i try to connect to the same database structure located at my godaddy webserver account, it does not seem to respond at all. The toast message contains empty. Please help.

  • February 24, 2019 at 20:21
    Permalink

    i got the error
    Warning: require_once(Android/includes/DbOperations.php): failed to open stream: No such file or directory in C:xampphtdocsAndroidv1registerUser.php on line 3

    Fatal error: require_once(): Failed opening required 'Android/includes/DbOperations.php' (include_path='C:xamppphpPEAR') in C:xampphtdocsAndroidv1registerUser.php on line 3

  • February 24, 2019 at 20:21
    Permalink

    please heeellpppp

    in my phpadmin, the only i'm recieving a "?" for username, "0" for my password, and "?" for my email.

    Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in C:xampphtdocsandroidincludesDbOperation.php on line 17
    {"error":false,"message":"User registered succesfully"}

  • February 24, 2019 at 20:21
    Permalink

    plz give me the solution for this error

    Fatal error: Uncaught Error: Call to a member function prepare() on null in C:xampphtdocsChatBotDbOperation.php:16 Stack trace: #0 C:xampphtdocsChatBotRegisterUser.php(20): DbOperation->createUser('ronak', 'f78cc277bfc0f69…', '12345') #1 {main} thrown in C:xampphtdocsChatBotDbOperation.php on line 16

  • February 24, 2019 at 20:21
    Permalink

    Hi, I follow your instruction, but i got a problem with Postman with state 2 statements (Object not found and Error 404). anything i can handle this problem?
    hope you can show me

  • February 24, 2019 at 20:21
    Permalink

    how i solve this problem.this problem show in require_once.
    Parse error: syntax error, unexpected '(', expecting '{' in C:xampphtdocsandroidincludesDbOperations.php on line 3

  • February 24, 2019 at 20:21
    Permalink

    mine is ok. but when i send the request using postman, there are 2 rows of data that inserted with the same value into the DB. why does that happen?

  • February 24, 2019 at 20:21
    Permalink

    Fatal error: Call to undefined method DbOperations::createUser() in C:XamppshtdocsAndroidv1RegisterUser.php on line 13

  • February 24, 2019 at 20:21
    Permalink

    Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in C:xampphtdocsAndroidincludesDbOperations.php on line 22
    {"ERROR":false,"message":"User registered successfully"}

  • February 24, 2019 at 20:21
    Permalink

    For all of those who are having the problem that postman is returning "Required fields are missing" (or wathever you indicated), what means that the server is not receiving values, do the following: In postman, DON´T push 'params' and add the params. Despite of this, go to the tab 'Body' (clickable when 'POST' method is selected) and then insert the values from there, selecting 'form-data' or 'x-www-form-urlencoded'. Hope it helps. It worked for me.

  • February 24, 2019 at 20:21
    Permalink

    I am getting an error with postman as are others i see but i dont see any decent answer. I get the error:

    <b>Warning</b>: require_once(../includes/DbOperations.php): failed to open stream: No such file or directory in
    <b>C:xampphtdocsAndroidv1registerUser.php</b> on line 3

    also i changed the directory to the full link to see if it would work and i get this:

    <b>Warning</b>: require_once(C:xampphtdocsAndroidincludes): failed to open stream: Permission denied in
    <b>C:xampphtdocsAndroidv1registerUser.php</b> on line
    <b>3</b>

  • February 24, 2019 at 20:21
    Permalink

    Postman wont work. help

    Could not get any response
    There was an error connecting to localhost/Android/v1/registerUser.php.

  • February 24, 2019 at 20:21
    Permalink

    ( ! ) Parse error: syntax error, unexpected '$response' (T_VARIABLE) in C:wamp64wwwAndroid_login_apiV1registerUser.php on line 19
    this error has showed up

  • February 24, 2019 at 20:21
    Permalink

    It works for GET method ,but when try with POST method on
    postman it show as preview this mark only ( [ ] ) it do not enter any values to the database.

Leave a Reply