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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.