MYSQLI Object oriented, what's wrong with my script?











up vote
-3
down vote

favorite












I'm trying to do an execution of a query and see if it goes well, but right now it doesn't enter the IF or ELSE.
I had it on mysqli procedural and all worked flawlessy now I'm trying to change it to object oriented and it won't enter inside if/else.



        if(isset($_POST['submit']))
{
$email = $_POST["email"];
$password = md5($_POST["password"]);

$query = "SELECT * FROM Users WHERE Email=? AND Password=?";
$stmt = $conn->prepare($query);
$stmt->bind_param('ss', $email,$password);
$stmt->execute();
$result = $stmt->get_result();

if ($result->num_rows == 1)
{
?>
<script type="text/javascript">
alert("INSIDE");
</script>
<?php
$row = $result->fetch_assoc();
if(isset($_POST['remember']))
{
$_SESSION["remember"] = "1";
}
$_SESSION["username"] = $row['Username'];
$_SESSION['check'] = "1";
$_SESSION['ID'] = $id;
$_SESSION['permission'] = $row['Admin'];
header("Location: dashboard.php");
exit;
}
else
{
?>
<script type="text/javascript">
alert("Credentials Are Wrong!");
</script>
<?php
exit;
}
$stmt->close();
}


Thank you all.










share|improve this question
























  • It'd be a lot easier to tell you what's wrong with it if you'd tell us what the problem is. Please include the error this returns, and what's supposed to happen instead.
    – Davіd
    yesterday










  • It doesn't execute the query, it gives error when executing query
    – Luca Verdecchia
    yesterday










  • Have you looked into using fetch() instead of query()?
    – Nigel Ren
    yesterday






  • 1




    md5() is not strong enough encryption.
    – mickmackusa
    yesterday






  • 1




    DO NOT use md5() as encryption. Use password_hash() and password_verify() instead.
    – rpm192
    yesterday















up vote
-3
down vote

favorite












I'm trying to do an execution of a query and see if it goes well, but right now it doesn't enter the IF or ELSE.
I had it on mysqli procedural and all worked flawlessy now I'm trying to change it to object oriented and it won't enter inside if/else.



        if(isset($_POST['submit']))
{
$email = $_POST["email"];
$password = md5($_POST["password"]);

$query = "SELECT * FROM Users WHERE Email=? AND Password=?";
$stmt = $conn->prepare($query);
$stmt->bind_param('ss', $email,$password);
$stmt->execute();
$result = $stmt->get_result();

if ($result->num_rows == 1)
{
?>
<script type="text/javascript">
alert("INSIDE");
</script>
<?php
$row = $result->fetch_assoc();
if(isset($_POST['remember']))
{
$_SESSION["remember"] = "1";
}
$_SESSION["username"] = $row['Username'];
$_SESSION['check'] = "1";
$_SESSION['ID'] = $id;
$_SESSION['permission'] = $row['Admin'];
header("Location: dashboard.php");
exit;
}
else
{
?>
<script type="text/javascript">
alert("Credentials Are Wrong!");
</script>
<?php
exit;
}
$stmt->close();
}


Thank you all.










share|improve this question
























  • It'd be a lot easier to tell you what's wrong with it if you'd tell us what the problem is. Please include the error this returns, and what's supposed to happen instead.
    – Davіd
    yesterday










  • It doesn't execute the query, it gives error when executing query
    – Luca Verdecchia
    yesterday










  • Have you looked into using fetch() instead of query()?
    – Nigel Ren
    yesterday






  • 1




    md5() is not strong enough encryption.
    – mickmackusa
    yesterday






  • 1




    DO NOT use md5() as encryption. Use password_hash() and password_verify() instead.
    – rpm192
    yesterday













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I'm trying to do an execution of a query and see if it goes well, but right now it doesn't enter the IF or ELSE.
I had it on mysqli procedural and all worked flawlessy now I'm trying to change it to object oriented and it won't enter inside if/else.



        if(isset($_POST['submit']))
{
$email = $_POST["email"];
$password = md5($_POST["password"]);

$query = "SELECT * FROM Users WHERE Email=? AND Password=?";
$stmt = $conn->prepare($query);
$stmt->bind_param('ss', $email,$password);
$stmt->execute();
$result = $stmt->get_result();

if ($result->num_rows == 1)
{
?>
<script type="text/javascript">
alert("INSIDE");
</script>
<?php
$row = $result->fetch_assoc();
if(isset($_POST['remember']))
{
$_SESSION["remember"] = "1";
}
$_SESSION["username"] = $row['Username'];
$_SESSION['check'] = "1";
$_SESSION['ID'] = $id;
$_SESSION['permission'] = $row['Admin'];
header("Location: dashboard.php");
exit;
}
else
{
?>
<script type="text/javascript">
alert("Credentials Are Wrong!");
</script>
<?php
exit;
}
$stmt->close();
}


Thank you all.










share|improve this question















I'm trying to do an execution of a query and see if it goes well, but right now it doesn't enter the IF or ELSE.
I had it on mysqli procedural and all worked flawlessy now I'm trying to change it to object oriented and it won't enter inside if/else.



        if(isset($_POST['submit']))
{
$email = $_POST["email"];
$password = md5($_POST["password"]);

$query = "SELECT * FROM Users WHERE Email=? AND Password=?";
$stmt = $conn->prepare($query);
$stmt->bind_param('ss', $email,$password);
$stmt->execute();
$result = $stmt->get_result();

if ($result->num_rows == 1)
{
?>
<script type="text/javascript">
alert("INSIDE");
</script>
<?php
$row = $result->fetch_assoc();
if(isset($_POST['remember']))
{
$_SESSION["remember"] = "1";
}
$_SESSION["username"] = $row['Username'];
$_SESSION['check'] = "1";
$_SESSION['ID'] = $id;
$_SESSION['permission'] = $row['Admin'];
header("Location: dashboard.php");
exit;
}
else
{
?>
<script type="text/javascript">
alert("Credentials Are Wrong!");
</script>
<?php
exit;
}
$stmt->close();
}


Thank you all.







php oop object mysqli






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday

























asked yesterday









Luca Verdecchia

125




125












  • It'd be a lot easier to tell you what's wrong with it if you'd tell us what the problem is. Please include the error this returns, and what's supposed to happen instead.
    – Davіd
    yesterday










  • It doesn't execute the query, it gives error when executing query
    – Luca Verdecchia
    yesterday










  • Have you looked into using fetch() instead of query()?
    – Nigel Ren
    yesterday






  • 1




    md5() is not strong enough encryption.
    – mickmackusa
    yesterday






  • 1




    DO NOT use md5() as encryption. Use password_hash() and password_verify() instead.
    – rpm192
    yesterday


















  • It'd be a lot easier to tell you what's wrong with it if you'd tell us what the problem is. Please include the error this returns, and what's supposed to happen instead.
    – Davіd
    yesterday










  • It doesn't execute the query, it gives error when executing query
    – Luca Verdecchia
    yesterday










  • Have you looked into using fetch() instead of query()?
    – Nigel Ren
    yesterday






  • 1




    md5() is not strong enough encryption.
    – mickmackusa
    yesterday






  • 1




    DO NOT use md5() as encryption. Use password_hash() and password_verify() instead.
    – rpm192
    yesterday
















It'd be a lot easier to tell you what's wrong with it if you'd tell us what the problem is. Please include the error this returns, and what's supposed to happen instead.
– Davіd
yesterday




It'd be a lot easier to tell you what's wrong with it if you'd tell us what the problem is. Please include the error this returns, and what's supposed to happen instead.
– Davіd
yesterday












It doesn't execute the query, it gives error when executing query
– Luca Verdecchia
yesterday




It doesn't execute the query, it gives error when executing query
– Luca Verdecchia
yesterday












Have you looked into using fetch() instead of query()?
– Nigel Ren
yesterday




Have you looked into using fetch() instead of query()?
– Nigel Ren
yesterday




1




1




md5() is not strong enough encryption.
– mickmackusa
yesterday




md5() is not strong enough encryption.
– mickmackusa
yesterday




1




1




DO NOT use md5() as encryption. Use password_hash() and password_verify() instead.
– rpm192
yesterday




DO NOT use md5() as encryption. Use password_hash() and password_verify() instead.
– rpm192
yesterday












2 Answers
2






active

oldest

votes

















up vote
0
down vote













You should be using



$stmt->bind_result($col1, $col2 ...);


and



$result = $stmt->fetch();


in order to access the data from the query, rather than



$conn->query($stmt);


(an example is provided at https://secure.php.net/manual/en/mysqli-stmt.fetch.php). Note that for this to work you will need to specify the column names you want to fetch from the database, rather than using * in your SQL query, and for each column data is fetched from in the query, you should have a variable for in the fetch() parameters, so for example, something as follows should work (note these may not match the names of your database columns):



$email = $_POST["email"]; 
$password = md5($_POST["password"]);

$stmt = $conn->prepare("SELECT ID, Name FROM Users WHERE Email=? AND Password=?");
$stmt->bind_param('ss', $email, $password);
$stmt->execute();
$stmt->bind_result($id, $name);
$stmt->fetch();
$stmt->close();
echo $id . ': ' . $name;





share|improve this answer








New contributor




M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    0
    down vote













    Updated Answer



    You are very close. Use $result = $stmt->get_result(); instead of $result = $stmt->query; to check to see if the query returned a result or not.



    $email = $_POST["email"]; 
    $password = md5($_POST["password"]);

    $query = "SELECT * FROM Users WHERE Email = ? AND Password = ?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param('ss', $email, $password);
    $stmt->execute();
    $result = $stmt->get_result();

    if($result->num_rows !== 0){

    if(isset($_POST['remember'])){
    $_SESSION["remember"] = "1";
    }

    $_SESSION['check'] = "1";
    $_SESSION['ID'] = $row['ID'];
    header("Location: dashboard.php");
    exit();

    }else{

    echo
    '<script type="text/javascript">
    alert("Credentials Are Wrong!");
    </script>';

    exit();

    }

    $stmt->close();


    As several have already stated in their comments do not use MD5 for password hashes. PHP has it's own built in functions for handling passwords. Please research Password_has() and Password_verify(). Spend the time to research and implement these now instead of later. It will save you time.






    share|improve this answer























    • Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
      – Luca Verdecchia
      yesterday












    • Run echo $result->num_rows; before the if statement and tell me what it says.
      – Joseph_J
      yesterday












    • There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
      – Luca Verdecchia
      yesterday












    • I don't see anything wrong with that line of code.
      – Joseph_J
      yesterday










    • I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
      – Luca Verdecchia
      yesterday











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237892%2fmysqli-object-oriented-whats-wrong-with-my-script%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You should be using



    $stmt->bind_result($col1, $col2 ...);


    and



    $result = $stmt->fetch();


    in order to access the data from the query, rather than



    $conn->query($stmt);


    (an example is provided at https://secure.php.net/manual/en/mysqli-stmt.fetch.php). Note that for this to work you will need to specify the column names you want to fetch from the database, rather than using * in your SQL query, and for each column data is fetched from in the query, you should have a variable for in the fetch() parameters, so for example, something as follows should work (note these may not match the names of your database columns):



    $email = $_POST["email"]; 
    $password = md5($_POST["password"]);

    $stmt = $conn->prepare("SELECT ID, Name FROM Users WHERE Email=? AND Password=?");
    $stmt->bind_param('ss', $email, $password);
    $stmt->execute();
    $stmt->bind_result($id, $name);
    $stmt->fetch();
    $stmt->close();
    echo $id . ': ' . $name;





    share|improve this answer








    New contributor




    M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote













      You should be using



      $stmt->bind_result($col1, $col2 ...);


      and



      $result = $stmt->fetch();


      in order to access the data from the query, rather than



      $conn->query($stmt);


      (an example is provided at https://secure.php.net/manual/en/mysqli-stmt.fetch.php). Note that for this to work you will need to specify the column names you want to fetch from the database, rather than using * in your SQL query, and for each column data is fetched from in the query, you should have a variable for in the fetch() parameters, so for example, something as follows should work (note these may not match the names of your database columns):



      $email = $_POST["email"]; 
      $password = md5($_POST["password"]);

      $stmt = $conn->prepare("SELECT ID, Name FROM Users WHERE Email=? AND Password=?");
      $stmt->bind_param('ss', $email, $password);
      $stmt->execute();
      $stmt->bind_result($id, $name);
      $stmt->fetch();
      $stmt->close();
      echo $id . ': ' . $name;





      share|improve this answer








      New contributor




      M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote










        up vote
        0
        down vote









        You should be using



        $stmt->bind_result($col1, $col2 ...);


        and



        $result = $stmt->fetch();


        in order to access the data from the query, rather than



        $conn->query($stmt);


        (an example is provided at https://secure.php.net/manual/en/mysqli-stmt.fetch.php). Note that for this to work you will need to specify the column names you want to fetch from the database, rather than using * in your SQL query, and for each column data is fetched from in the query, you should have a variable for in the fetch() parameters, so for example, something as follows should work (note these may not match the names of your database columns):



        $email = $_POST["email"]; 
        $password = md5($_POST["password"]);

        $stmt = $conn->prepare("SELECT ID, Name FROM Users WHERE Email=? AND Password=?");
        $stmt->bind_param('ss', $email, $password);
        $stmt->execute();
        $stmt->bind_result($id, $name);
        $stmt->fetch();
        $stmt->close();
        echo $id . ': ' . $name;





        share|improve this answer








        New contributor




        M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        You should be using



        $stmt->bind_result($col1, $col2 ...);


        and



        $result = $stmt->fetch();


        in order to access the data from the query, rather than



        $conn->query($stmt);


        (an example is provided at https://secure.php.net/manual/en/mysqli-stmt.fetch.php). Note that for this to work you will need to specify the column names you want to fetch from the database, rather than using * in your SQL query, and for each column data is fetched from in the query, you should have a variable for in the fetch() parameters, so for example, something as follows should work (note these may not match the names of your database columns):



        $email = $_POST["email"]; 
        $password = md5($_POST["password"]);

        $stmt = $conn->prepare("SELECT ID, Name FROM Users WHERE Email=? AND Password=?");
        $stmt->bind_param('ss', $email, $password);
        $stmt->execute();
        $stmt->bind_result($id, $name);
        $stmt->fetch();
        $stmt->close();
        echo $id . ': ' . $name;






        share|improve this answer








        New contributor




        M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered yesterday









        M. Kilpatrick

        1611




        1611




        New contributor




        M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        M. Kilpatrick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.
























            up vote
            0
            down vote













            Updated Answer



            You are very close. Use $result = $stmt->get_result(); instead of $result = $stmt->query; to check to see if the query returned a result or not.



            $email = $_POST["email"]; 
            $password = md5($_POST["password"]);

            $query = "SELECT * FROM Users WHERE Email = ? AND Password = ?";
            $stmt = $conn->prepare($query);
            $stmt->bind_param('ss', $email, $password);
            $stmt->execute();
            $result = $stmt->get_result();

            if($result->num_rows !== 0){

            if(isset($_POST['remember'])){
            $_SESSION["remember"] = "1";
            }

            $_SESSION['check'] = "1";
            $_SESSION['ID'] = $row['ID'];
            header("Location: dashboard.php");
            exit();

            }else{

            echo
            '<script type="text/javascript">
            alert("Credentials Are Wrong!");
            </script>';

            exit();

            }

            $stmt->close();


            As several have already stated in their comments do not use MD5 for password hashes. PHP has it's own built in functions for handling passwords. Please research Password_has() and Password_verify(). Spend the time to research and implement these now instead of later. It will save you time.






            share|improve this answer























            • Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
              – Luca Verdecchia
              yesterday












            • Run echo $result->num_rows; before the if statement and tell me what it says.
              – Joseph_J
              yesterday












            • There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday












            • I don't see anything wrong with that line of code.
              – Joseph_J
              yesterday










            • I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday















            up vote
            0
            down vote













            Updated Answer



            You are very close. Use $result = $stmt->get_result(); instead of $result = $stmt->query; to check to see if the query returned a result or not.



            $email = $_POST["email"]; 
            $password = md5($_POST["password"]);

            $query = "SELECT * FROM Users WHERE Email = ? AND Password = ?";
            $stmt = $conn->prepare($query);
            $stmt->bind_param('ss', $email, $password);
            $stmt->execute();
            $result = $stmt->get_result();

            if($result->num_rows !== 0){

            if(isset($_POST['remember'])){
            $_SESSION["remember"] = "1";
            }

            $_SESSION['check'] = "1";
            $_SESSION['ID'] = $row['ID'];
            header("Location: dashboard.php");
            exit();

            }else{

            echo
            '<script type="text/javascript">
            alert("Credentials Are Wrong!");
            </script>';

            exit();

            }

            $stmt->close();


            As several have already stated in their comments do not use MD5 for password hashes. PHP has it's own built in functions for handling passwords. Please research Password_has() and Password_verify(). Spend the time to research and implement these now instead of later. It will save you time.






            share|improve this answer























            • Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
              – Luca Verdecchia
              yesterday












            • Run echo $result->num_rows; before the if statement and tell me what it says.
              – Joseph_J
              yesterday












            • There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday












            • I don't see anything wrong with that line of code.
              – Joseph_J
              yesterday










            • I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday













            up vote
            0
            down vote










            up vote
            0
            down vote









            Updated Answer



            You are very close. Use $result = $stmt->get_result(); instead of $result = $stmt->query; to check to see if the query returned a result or not.



            $email = $_POST["email"]; 
            $password = md5($_POST["password"]);

            $query = "SELECT * FROM Users WHERE Email = ? AND Password = ?";
            $stmt = $conn->prepare($query);
            $stmt->bind_param('ss', $email, $password);
            $stmt->execute();
            $result = $stmt->get_result();

            if($result->num_rows !== 0){

            if(isset($_POST['remember'])){
            $_SESSION["remember"] = "1";
            }

            $_SESSION['check'] = "1";
            $_SESSION['ID'] = $row['ID'];
            header("Location: dashboard.php");
            exit();

            }else{

            echo
            '<script type="text/javascript">
            alert("Credentials Are Wrong!");
            </script>';

            exit();

            }

            $stmt->close();


            As several have already stated in their comments do not use MD5 for password hashes. PHP has it's own built in functions for handling passwords. Please research Password_has() and Password_verify(). Spend the time to research and implement these now instead of later. It will save you time.






            share|improve this answer














            Updated Answer



            You are very close. Use $result = $stmt->get_result(); instead of $result = $stmt->query; to check to see if the query returned a result or not.



            $email = $_POST["email"]; 
            $password = md5($_POST["password"]);

            $query = "SELECT * FROM Users WHERE Email = ? AND Password = ?";
            $stmt = $conn->prepare($query);
            $stmt->bind_param('ss', $email, $password);
            $stmt->execute();
            $result = $stmt->get_result();

            if($result->num_rows !== 0){

            if(isset($_POST['remember'])){
            $_SESSION["remember"] = "1";
            }

            $_SESSION['check'] = "1";
            $_SESSION['ID'] = $row['ID'];
            header("Location: dashboard.php");
            exit();

            }else{

            echo
            '<script type="text/javascript">
            alert("Credentials Are Wrong!");
            </script>';

            exit();

            }

            $stmt->close();


            As several have already stated in their comments do not use MD5 for password hashes. PHP has it's own built in functions for handling passwords. Please research Password_has() and Password_verify(). Spend the time to research and implement these now instead of later. It will save you time.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited yesterday

























            answered yesterday









            Joseph_J

            2,6221617




            2,6221617












            • Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
              – Luca Verdecchia
              yesterday












            • Run echo $result->num_rows; before the if statement and tell me what it says.
              – Joseph_J
              yesterday












            • There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday












            • I don't see anything wrong with that line of code.
              – Joseph_J
              yesterday










            • I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday


















            • Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
              – Luca Verdecchia
              yesterday












            • Run echo $result->num_rows; before the if statement and tell me what it says.
              – Joseph_J
              yesterday












            • There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday












            • I don't see anything wrong with that line of code.
              – Joseph_J
              yesterday










            • I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
              – Luca Verdecchia
              yesterday
















            Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
            – Luca Verdecchia
            yesterday






            Thanks for the responce, and I will surely see php functions for password hash! But I've done as you told and now it seems that it doesn't go inside IF or ELSE. Check my original post for the new version of the code
            – Luca Verdecchia
            yesterday














            Run echo $result->num_rows; before the if statement and tell me what it says.
            – Joseph_J
            yesterday






            Run echo $result->num_rows; before the if statement and tell me what it says.
            – Joseph_J
            yesterday














            There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
            – Luca Verdecchia
            yesterday






            There is some error as browser says 500 error, so there is an error on the code but dreamviewer doesn't tell me anything about errors. If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
            – Luca Verdecchia
            yesterday














            I don't see anything wrong with that line of code.
            – Joseph_J
            yesterday




            I don't see anything wrong with that line of code.
            – Joseph_J
            yesterday












            I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
            – Luca Verdecchia
            yesterday




            I've updated the answer, If i remove $result = $stmt->get_result(); the browser doesn't display any 500 error
            – Luca Verdecchia
            yesterday


















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237892%2fmysqli-object-oriented-whats-wrong-with-my-script%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            Popular posts from this blog

            Full-time equivalent

            さくらももこ

            13 indicted, 8 arrested in Calif. drug cartel investigation