sandesigns Posted June 20, 2011 Share Posted June 20, 2011 Hey, I am new to this forum and thought I would join as this seems to be a good place for problem solving/learning. I have recently started learning php and mysql (basic) I have already run into a problem.. problem: I have created a database which i was using to test a simple login system. the error i get is: Warning: mysql_num_rows() expects parameter 1 to be resource, object given in C:\xampp\htdocs\test.php on line 8 I do not know what i am doing wrong but the method im using is search the database for matching username & password, find if any rows are returned if so then login successful else wrong login. <?php $cxn = mysqli_connect("","root","","loginsystem"); $query= "SELECT name FROM user WHERE login='user' AND password='password'"; $result = mysqli_query($cxn,$query) or die("error"); // works from here $n = mysql_num_rows($result); echo $n; ?> any help will be appreciated! -Sandeep Link to comment https://forums.phpfreaks.com/topic/239896-simple-problem-requiring-help/ Share on other sites More sharing options...
Pikachu2000 Posted June 20, 2011 Share Posted June 20, 2011 You can't mix mysqli_* and mysql_* functions . . . Link to comment https://forums.phpfreaks.com/topic/239896-simple-problem-requiring-help/#findComment-1232258 Share on other sites More sharing options...
sandesigns Posted June 20, 2011 Author Share Posted June 20, 2011 Thank you, problem was solved I just changed the mysql_num_rows to mysqli_num_rows Link to comment https://forums.phpfreaks.com/topic/239896-simple-problem-requiring-help/#findComment-1232271 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.