473,799 Members | 2,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mysql_query / password error

7 New Member
Apache 2.0
PHP 4.4
MySQL 5.0
=========
Ok, here what is going on! Every time when I trying to login into system I’m getting message (its last “else” in F_LogIn function):
“Nothing is working”
and so result of this:
“You could not be logged in”
I don’t know why it’s happen, but by testing my query, I found out that problem in “user_password” , without this parameter everything is working smoothly. To be more precise, the query is not returning any row from DB.
Because of this I’m seriously stuck and can’t move on with this project. I didn’t found any tips in internet so decided to post here.

[php]<?php
$user_name = $_POST ["user_name"];
$user_password = $_POST ["user_passw ord"];
session_start ();
if ($user_name && $user_password)
{
if (F_LogIn ($user_name, $user_password) )
{
$valid_user = $user_name;
$_SESSION ['valid_user'] = $user_name;
}
else
{
print "You could not be logged in <br />";
print "NAME = $user_name <br /> PASSWORD = $user_password <br />";
exit;
}
}
F_CheckValidUse r ();
?>

<br />
<a href = "LogOut.php">Lo gOut</a>

<?php
function F_LogIn ($user_name, $user_password)
{
$connection_sta tus = F_DBConnect();
if (!$connection_s tatus)
{
print "No connection to DB";
return false;
}
$query = "SELECT * FROM tbl_user_detail WHERE clm_user_name = '$user_name' AND clm_password = OLD_PASSWORD ('$user_passwor d')";
$query_result = mysql_query ($query, $connection_sta tus);
//$query_result_2 = mysql_fetch_row ($query_result) ;
//print $query_result_2 ["clm_user_n ame"];
if (!$query_result )
{
print "Invalide query";
return false;
}
else
{
if (mysql_num_rows ($query_result) )
{
print "Query OK" . mysql_num_rows ($query_result) . "<br />";
return true;
}
else
{
print "<br />Nothing is working " . mysql_num_rows ($query_result) . "<br />";
return false;
}
}
}

function F_DBConnect ()
{
$connection_sta tus = mysql_pconnect ("localhost" , "root", "111");
if (!$connection_s tatus)
{
return false;
}
if (!mysql_select_ db ("test", $connection_sta tus))
{
return false;
}
return $connection_sta tus;
}

function F_CheckValidUse r ()
{
//global $valid_user;
if (isset($_SESSIO N ['valid_user']))
{
print "Logged in as " . $valid_user . "<br />";
?>

<br />
<a href = "LogOutTest.php "> Log Out Test</a>
<br />

<?php
}
else
{
print "You are not logged in <br />";
?>

<a href = "LogInForm.php" >Log In</a>
<br />
<a href = "LogOut.php">Lo g Out</a>
<br />
<a href = "LogOutTest.php "> Log Out Test</a>

<?php
exit;
}
}
?>[/php]
And one more thing, the query that used to register user is:
[php]...
$query_result = mysql_query ("INSERT INTO tbl_user_detail
VALUES ('$user_name', OLD_PASSWORD('$ user_password') , '$user_email')" );...[/php]
Mar 1 '07 #1
0 1145

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

Similar topics

4
15774
by: Bruce A. Julseth | last post by:
I know the following $sql will fail since there is no Customer='Smith'. I want to determine how to test a failure of mysql_query. I thought mysql_query returned false if a query failed. The test fail path is never taken in the following code is never taken. Also, I get an invalid argument on mysql_num_rows($Result) error message. $sql = "Update Table Set Password='password' where Customer='Smith';
5
8783
by: lkrubner | last post by:
www.php.net says: >>>>>>>>>>>> Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query() returns a resource identifier or FALSE if the query was not executed correctly. For other type of SQL statements, mysql_query() returns TRUE on success and FALSE on error. A non-FALSE return value means that the query was legal and could be executed by the server. It does not indicate anything about the number of rows affected or returned. It...
6
4674
by: aa | last post by:
I use the following fragment of code to output datf from MySQL: ====================================================== $chan = mysql_connect ($db_host, $username, $password); mysql_select_db ($DB_name, $chan); $resultid = mysql_query ("select name_ru, description_ru, retail, dealer from lasershot WHERE le='1'", $chan); ........ ======================================================
7
3928
by: John Moore | last post by:
Hi I posted three days ago about a function I wrote which kept refusing to run a mysql_query. Well I did away with the function, and hard coded the variables into the query itself. Here's what I have now: mysql_query("UPDATE about SET category_id = 58 WHERE about_id = 5") or die('error: ' . mysql_error());
5
2922
by: Chameleon | last post by:
I have a SQL Script with about 5000 SQL Commands. How can I send it to SQL Server at once? I see mysql_query() fails on first semicolon (;) who delimits the SQL Commands. Another question: I send to a MySQL server via fast Internet connection, about 500 INSERT
2
16937
by: techjohnny | last post by:
Error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/jplane/certcent/phpweb/quiz/index.php on line 21 PHP CODE:
4
5159
by: atyndall | last post by:
OK, this is the relevant portion script: <?php $username = '__'; // MySQL Database Username. $password = '__'; // MySQL Database Password. $server = '__'; // MySQL Database server (most likely localhost).
6
10989
by: aerobat | last post by:
hello all just wondering if anyone can help me with this problem. Ii has to do with a simple mysql_query. i have tried so many different ways of doing it, but it wont work. here is the code: #include <stdio.h> #include <math.h> #include <string.h> #include <mysql.h> main() {
5
9142
by: lisles | last post by:
i have a page funtion.php which hs the function to connect to the db /* Mysql Connection */ function connect(){ global $db_server,$db_user,$db_pass,$db;//Global Values from the config.php $conn = @mysql_connect($db_server,$db_user,$db_pass) or die("Connection to Database Server Failed"); @mysql_select_db($db) or die("Database Selection Failed"); return $conn; }
0
10475
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10026
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.