Re: [PHP-DB] Strange problem with mySQL

2004-03-25 Thread Doug Thompson
Brown, Craig wrote:


I am trying to update a database that I use to store user names and the 
hashed values of passwords. The database name is Login, the table is 
"users".

I have the following commands in my php file.

@ $db=mysql_pconnect('localhost','apache','password');
mysql_select_db('Login');
$query="UPDATE users set pw='$hash' WHERE id='$user'";
$results = mysql_query($query);
The result is always false. If I enter the value of $query into a 
console (such as mysqlcc). The command works fine. Any ideas?

Thanks!

Craig

Actually, you are entering at the console the value you are hoping $query will have.  You never test to see what $query actually is or what is the error.  Do you know for sure that the correct value of $user is being parsed?  Do you even know that the script made a valid  connection and db selection?

Put an ECHO $query; statement and some other error checking in there and quit tearing out your hair over assumptions that may be wrong.

Doug

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Strange problem with mySQL

2004-03-25 Thread jeffrey_n_Dyke




>I am trying to update a database that I use to store user names and the
hashed values of passwords. The database name is Login, the table is
"users".


>I have the following commands in my php file.


>@ $db=mysql_pconnect('localhost','apache','password');
>mysql_select_db('Login');
>  $query="UPDATE users set pw='$hash' WHERE id='$user'";
>$results = mysql_query($query);


>The result is always false. If I enter the value of $query into a console
(such as mysqlcc). The command works fine. Any ideas?


If it is false, mysql must be compaining about something, have your
tried.
$results = mysql_query($query) or die(mysql_error() . "  on query --> "
.$query);

hth
Jeff


>Thanks!


Craig --
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Strange problem with mySQL

2004-03-25 Thread Brown, Craig
Title: Strange problem with mySQL








I am trying to update a database that I use to store user names and the hashed values of passwords. The database name is Login, the table is "users".

I have the following commands in my php file.



    @ $db=mysql_pconnect('localhost','apache','password');

    mysql_select_db('Login');

    $query="UPDATE users set pw='$hash' WHERE id='$user'";

    $results = mysql_query($query);


The result is always false. If I enter the value of $query into a console (such as mysqlcc). The command works fine. Any ideas?

Thanks!


Craig



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php