Jump to content

Simple problem requiring help


sandesigns

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.