473,486 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Undefined variable: numrows in C:\xampp\htdocs\csrc\Untitled-1.php on line 16

3 New Member
Expand|Select|Wrap|Line Numbers
  1. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  2.     $db_rows= '';
  3.     if ($numrows!=0)
  4.     {
  5.         while ($row = mysql_fetch_assoc($query))
  6.         {
  7.             $dbusername = $row['username'];
  8.             $dbpassword = $row['password'];
  9.         }
  10.         //check to see if match!;
  11.         if ($username==$dbusername&&$password==$dbpassword)
  12.         {
  13.             //echo "You're IN!";
  14.             header("location: main.php");
  15.             $_SESSION['username']=$dbusername;
  16.         }
  17.         else
  18.             echo "Incorrect password!";
  19.  
  20.     }
  21.     else
Jan 15 '14 #1
2 1571
Rabbit
12,516 Recognized Expert Moderator MVP
Please use code tags when posting code or formatted data.

The error message is pretty clear. You use a variable that you didn't declared.
Jan 15 '14 #2
Dormilich
8,658 Recognized Expert Moderator Expert
this whole code is much too complicated (logic-wise). if you want to know, if a certain password matches a certain existing user, ask the DB that directly. i.e.
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) FROM table WHERE username = ? AND password = ?
Jan 16 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
8255
by: Dan Finn | last post by:
OpenBSD 3.2 Apache 1.3.26 PHP 4.3.4 PHP-Nuke 6.9 getting these in the apache error log: Sun Nov 16 20:20:16 2003] PHP Notice: Undefined variable: HTTP_USER_AGENT in...
4
4130
by: Chris Beall | last post by:
If you want your code to be bulletproof, do you have to explicitly check for the existence of any possibly-undefined variable? Example: window.outerHeight is defined by some browsers, but not...
1
15265
by: prabhunew2005 | last post by:
hi I am doing web portal design using php. I gave part of one of my screen coding. <html> <head> <script language = "javascript"> function list_all_click()
2
3434
by: Bob Bruyn | last post by:
I've recently installed Apache 2 and php 5.2 on my WIndows XP machine. Everything is up and running. I'm passing some vars via the URL. It works fine online:...
5
7165
by: siyaverma | last post by:
Hi, I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that, After doing some changes when i run it on my...
3
2516
Markus
by: Markus | last post by:
I was just playing around with javascript today and i wanted to change the style of a table element with javascript. The code i am using: ChangeIt(id){ var target = document.getElementById(id)...
1
7559
by: bob johnson | last post by:
Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7 Notice: Undefined variable: db_user in C:\wamp\www\cbmall\index.php on line 7 Notice: Undefined variable: db_pass...
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.