Comments (218)

  1. Hello Sir,

    I have ran code and its given me following error pelase let me know what i have to do for it,

    Error: Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.” UserInfo=0x8da2030.

    Thanks,

  2. priya

    hi Dipin, my logintodb.php is below:

    $host = “localhost”;
    $user = “root”;
    $pass = “root”;
    $db=”iwll”;

    $r = mysql_connect($host, $user, $pass);

    if (!$r) {
    echo “Could not connect to server\n”;
    trigger_error(mysql_error(), E_USER_ERROR);
    } else {
    echo “Connection established\n”;
    }

    echo mysql_get_server_info() . “\n”;
    $r2 = mysql_select_db($db);

    if (!$r2) {
    echo “Cannot select database\n”;
    trigger_error(mysql_error(), E_USER_ERROR);
    } else {
    echo “database selected\n”;
    }
    $us=$_POST[‘username’];
    $pw=$_POST[‘password’];
    $result=mysql_query(“select username,pass from login where username=’$us’ and pass=’$pw'”);

    $row=mysql_fetch_array($result);
    if($row[“username”]==$us && $row[“pass”]==$pw)
    {
    echo ‘{“success”:1}’;

    }
    else
    {
    echo ‘{“success”:0,”error_message”:”Username and/or password is invalid.”}’;

    }

  3. priya

    if i changed like that my output is:
    2014-11-05 16:24:06.764 logintodb[90940:90b] Response ==> Connection established
    5.5.38
    database selected
    {“success”:1}
    2014-11-05 16:24:06.764 logintodb[90940:90b] Success: 0
    and i got pop-up as Login failed
    why i got initially success:1 and then success:0
    pls explain me?

  4. priya

    nice tutorial.i have written my php code as:
    if($row[“username”]==$u && $row[“pass”]==$pw)
    {
    echo ‘”success”:1’;
    }
    else
    {
    echo ‘{“success”:0,”error_message”:”Username and/or password is invalid.”}’;

    }
    but i got in console pane as:2014-11-04 12:06:14.701 logintodb[5003:90b] Response ==> Connection established
    5.5.38
    database selected
    “success”:1
    2014-11-04 12:06:14.701 logintodb[5003:90b] Success: 0
    i dont know what it means?pls help me?

  5. anu

    Excellent tutorial! I have tried with this code.i am using MAMP server.so i don’t know what i have to put here:
    NSURL *url=[NSURL URLWithString:@”https://dipinkrishna.com/jsonlogin.php”];
    could u pls help me?

  6. Emi

    What do you mean by setting tab bar controller as the root view controller. Does it mean selecting this as a initial view controller? Are they same concept? How do you set a view controller as a root view controller? Could you provide sample code, please?

  7. Anshu

    hi dipin,
    thanx for your wonderful tutorial.It works for me.
    but there is one problem, when i tried to change my php file code to get username and password from mysql database i got an error saying signin failed. will u pls send me a php code where mysql database connectivity is done and in that case if there is any change i would like to do in my objective C code to get response from edited php file becoz right now i am getting a response(NULL) and success:0.
    thanks in advance.

Leave a comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.