473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't login to my own forum, that sucks

I'm unable to login? plz help

Expand|Select|Wrap|Line Numbers
  1.  
  2. session_start();
  3. include_once ('dbconnect.php');
  4.  
  5.  
  6. if(isset($_POST['log'])) {
  7.     $dbselect = mysql_query("USE codb");
  8.     $uname = mysql_real_escape_string($_POST['username']);
  9.     $upass = mysql_real_escape_string($_POST['pass']);
  10.     $sql = mysql_query("SELECT * FROM users WHERE username=".$uname." AND password=".$upass." LIMIT 1");
  11.     $res = mysql_query($sql);
  12.  
  13.  
  14.     if(mysql_num_rows($res) == 1) {
  15.         $row = mysql_fetch_assoc($res);
  16.         $_SESSION['user'] = $row['user_id'];
  17.         header("Location: speak.php");
  18.     }else{
  19.         $error = error_reporting(E_ALL^E_WARNING);
  20.         echo "<script>alert('Wrong details!');</script>";
  21.     }
  22.  
  23. }
  24.  
  25.  



It displays
Expand|Select|Wrap|Line Numbers
  1.  
  2. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\log.php on line 14
  3.  
Jan 30 '16 #1
3 1168
RonB
589 Expert Mod 512MB
Your mysql_query($sql)statement failed i.e., it returned FALSE. Add error checking/handling to that statement to find out why it failed.

Hint, you have a syntax (quoting) error in the query.
Jan 30 '16 #2
Error checking and handling? what is it?
And where's the quoting error please? tnx
Feb 1 '16 #3
Error checking and handling? what is it? If it's like

Expand|Select|Wrap|Line Numbers
  1. $error = error_reporting(); 
, then i don't see how it would be useful to fix this problem. If not then what is it?

And where's the quoting error please? tnx
Feb 1 '16 #4

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

Similar topics

1
by: Egon Schneider | last post by:
Hi *, I have a a website running for a bunch of people, written in PHP. Everyone has it's own login, I use some session-based authentication mechanism and a MySQL database for storing the users...
3
by: tchangmian | last post by:
I want to limit user login by writing ASP program. In details, if a user had logged in wrongly for more than three times, then the user will not be abled to log in to the system anymore even...
3
by: clintonG | last post by:
That's the title of the suggestion I just left at MSDN Product Feedback Center . Please login, use that string to find the suggestion I made and vote for it to support my outrageous demands. If you...
0
by: Brian | last post by:
Hello, I usually login a forum and post some messages. I can't directly post message because the forum ask me to login first. I guess it need some session information. Now I want to program a...
2
by: yaya319 | last post by:
I have been trying for some time to log into my yahoo on my cell phone and it says login incorrect or data server unailable.Please help thank you ...
5
by: dba123 | last post by:
Who can I contact to complain about this entire newsgroup UI? It's horrible, and half the time, the right pane doesn't load...even in other browsers. It's sluggish as well, just very choppy. --...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
0
by: =?Utf-8?B?Q2hpV2hpdGVTb3g=?= | last post by:
Hi, i got machine A that has sql2005, vs2005 project. project runs okay there. But when i copied that whole project folder to machine B, running sql2005, VS2005, edited the web.config file to...
2
by: beyrself | last post by:
Hi, i've created a application using microsoft visual studio 2005. I've publish the exe application using IIS. now is issue is. I need to restrict the login part. For example is A login to this...
5
by: lgoddgreat | last post by:
Hi I have this project currently on going and I'm stack in the login form, I've done most of the part but still i cant seem to find a solution to this part. the login form has 2 Textbox and 1...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.