divinedesigns1 Posted June 21, 2012 Share Posted June 21, 2012 hey morning all, i keep having this error and im not sure what exactly to do Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\TINCS 2012 Edit\admin\login.php on line 12 i try adding the variable to connect to the database but that didnt work, then i try leaving the query only in it, that didnt work either then i try the result that didnt work either, dont mysqli_num_rows(); just need the $query only or the connect variable and the query? Note: I am looking up these errors and function that i dont know how to fix it, if i get it fix ill say how i fixed it Link to comment Share on other sites More sharing options...
divinedesigns1 Posted June 21, 2012 Author Share Posted June 21, 2012 nevermind i fixed it, i had the mysqli_num_rows(); outside of the if statement, which depended on the result like this: $login_check = mysqli_num_rows($result);if($result){ } so i just placed it into the if statement like what is shown below and it fix the error if($result){ $login_check = mysqli_num_rows($result);} Link to comment Share on other sites More sharing options...
Don E Posted June 21, 2012 Share Posted June 21, 2012 (edited) This is the way I understand how it works procedural style: $result = mysqli_query($dbconnection, "SELECT * FROM table"); $rows = mysqli_num_rows($result); $rows should then contain the number of rows. Edited June 21, 2012 by Don E Link to comment Share on other sites More sharing options...
divinedesigns1 Posted June 21, 2012 Author Share Posted June 21, 2012 (edited) This is the way I understand how it works procedural style: $result = mysqli_query($dbconnection, "SELECT * FROM table"); $rows = mysqli_num_rows($result); $rows should then contain the number of rows. okie ill write that down, also do you know what this meanParse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\TINCS 2012 Edit\admin\login.php on line 28 its asking for the semicolon but its there already, the line below is where the error is coming fromecho '<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">'; EDIT: the semicolon is there on each line where it needs to be and in the correct places where it need to be, well it should be in the correct places Edited June 21, 2012 by DDs1 Link to comment Share on other sites More sharing options...
divinedesigns1 Posted June 21, 2012 Author Share Posted June 21, 2012 i fix the error, by remove the <?php $_SERVER['PHP_SELF']; ?> but i would like to know why it wasnt working with that in it, shouldnt it work even if it have that in it? Link to comment Share on other sites More sharing options...
Don E Posted June 21, 2012 Share Posted June 21, 2012 (edited) Try this by removing the PHP tags because since you're echoing to begin with, it looks like you have opening and closing PHP tags already established for this particular page or segment of code for that page. echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; Edited June 21, 2012 by Don E Link to comment Share on other sites More sharing options...
divinedesigns1 Posted June 21, 2012 Author Share Posted June 21, 2012 Try this by removing the PHP tags because since you're echoing to begin with, it looks like you have opening and closing PHP tags already established for this particular page or segment of code for that page. echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; ooo ok i got it now thanks don Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now