Re: [PHP-DB] MySQL result resource

2003-02-01 Thread Edwin Boersma
Agree fully

Try this:
$query = select * from category where id=$scrow-category;
$result = mysql_query($query) or die( mysql_error() );

If your query fails, and u still can't find the reason from the 
information that mysql_error() give you, put a echo $query inbetween 
to see which string your passing to mysql_query().

Edwin


John W. Holmes wrote:
It means your query failed... it always means your query failed for some
reason (unless you typo a variable name...). Learn to use mysql_error()
in conjunction with mysql_query(). Also, like I said before,
mysql_db_query() is depreciated, you should be using mysql_query().

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-Original Message-
From: Addison Ellis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 10:02 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL result resource

hello,
	i have a new issue... :-)
	i am getting:
Warning: Supplied argument is not a valid MySQL result resource in
/users/infoserv/web/register/ca/admin/catads.php on line 54

from:
?
while($row = mysql_fetch_object($obj))
{
  $scobj = mysql_db_query($dbname,select * from subcategory
where id=$row-subcategory);
  $scrow = mysql_fetch_object($scobj);
  $cobj = mysql_db_query($dbname,select * from category where
id=$scrow-category);//54
  $crow = mysql_fetch_object($cobj);
?


any ideas, of course, are most appreciated. thank you and best,


addison


--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]







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




RE: [PHP-DB] MySQL result resource

2003-01-29 Thread John W. Holmes
It means your query failed... it always means your query failed for some
reason (unless you typo a variable name...). Learn to use mysql_error()
in conjunction with mysql_query(). Also, like I said before,
mysql_db_query() is depreciated, you should be using mysql_query().

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

 -Original Message-
 From: Addison Ellis [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 29, 2003 10:02 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL result resource
 
 hello,
   i have a new issue... :-)
   i am getting:
 Warning: Supplied argument is not a valid MySQL result resource in
 /users/infoserv/web/register/ca/admin/catads.php on line 54
 
 from:
 ?
  while($row = mysql_fetch_object($obj))
  {
$scobj = mysql_db_query($dbname,select * from subcategory
 where id=$row-subcategory);
$scrow = mysql_fetch_object($scobj);
$cobj = mysql_db_query($dbname,select * from category where
 id=$scrow-category);//54
$crow = mysql_fetch_object($cobj);
 ?
 
 
 any ideas, of course, are most appreciated. thank you and best,
addison
 --
 Addison Ellis
 small independent publishing co.
 114 B 29th Avenue North
 Nashville, TN 37203
 (615) 321-1791
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 subsidiaries of small independent publishing co.
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]



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




RE: [PHP-DB] MySQL Result Resource

2002-01-11 Thread matt stewart

shouldn't it be PASSWORD('madonna') ??

-Original Message-
From: Necro [mailto:[EMAIL PROTECTED]]
Sent: 11 January 2002 04:39
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


http://www.hotscripts.com/Detailed/4219.html  --- that is the script

But I cannot use crypt() on a winodws system. So I tried MD5, now I try
PASSWORD.

Any one got any idea how to make the script work with either of those??

Andrew

-Original Message-
From: Necro [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:30 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Daniel,

I had tried both with and without quotes. Neither work.

Without quotes I get:
select password, 1 as auth from acl where username='andrewd' and password =
PASSWORD(madonna)1054 : Unknown column 'madonna' in 'where clause'

Notice that madonna has not been crypted by the PASSWORD call either.

Andrew

-Original Message-
From: Daniel Barton [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:40 PM
To: Necro
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource


Andrew:

Don't put quotes around your MySQL function call.

i.e.

PASSWORD($password)

not

'PASSWORD($password)'

p.s. Looking at this thread, it seems like most of the errors you're
encountering have
nothing to do with md5() or password(), but with syntax, like placement of
quotes, or
whether they are single quotes or double quotes. I would suggest
experimenting with
the syntax a bit, to check out what's kosher, and what's not? Check out the
PHP
manual's sections on 'Resource id's - I think you may find it to be very
important to
understanding how PHP interacts with databases. Resource ids, which are
returned by
quite a few function calls, are not classic variables - they need to be
manipulated or
interpreted before you use them.

Cheers,
db



Necro wrote:

 Ok,

 I have tried to go to PASSWORD after none of the suggestions worked out.

 The current statement is:
 $arg = select password, 1 as auth from acl where
username='$username' and
 password = 'PASSWORD($password)';

 But the error I get now is:
 select password, 1 as auth from acl where username='andrewd' and password
=
 'PASSWORD(madonna)'Resource id #2

 Any ideas?

 Andrew

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 8:56 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource

 Addressed to: Necro [EMAIL PROTECTED]
   [EMAIL PROTECTED]

 ** Reply to note from Necro [EMAIL PROTECTED] Fri, 11 Jan 2002
 03:41:43 +1100
  select password, 1 as auth from acl where (username='andrewd' and
  password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in
 your
  SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1
 
  Does that help give any idea at all as to what the problem is?
 

 There are no quotes around  163e06103a371fd95b21b4a849bb4b91  The
 error occurs where it does because '163e06103' is a valid exponential
 notation value for a nubmer, but having an 'a' follow it is not valid.

 My solution would be:

 $Pass = md5( whatever ); #  I don't care if you hash just the password
  #  or the username and password as long as
  #  you do it the same way as you entered
  #  the passwords.

 mysql_query( SELECT password, 1 AS auth  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 But I question what you are doing returning password, so it might work
 as well as:

 mysql_query( SELECT count(*) as Authorized  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 This returns 0 or 1 in a field named Authorized depending on if the
 password matches or not.

 You might also want to look at the MySQL PASSWORD() function and not
 mess with md5 at all.

 Rick

 Rick Widmer
 Internet Marketing Specialists
 http://www.developersdesk.com

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
--
Dan Barton
Terrestrial Program Biologist
Asst. Data Manager
Point Reyes Bird Observatory
http://www.prbo.org
[EMAIL PROTECTED]
[EMAIL PROTECTED]



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL

Re: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Miles Thompson


The use of the MD5 function in the query doesn't look quite right.
Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if 
concatenating?

Also, mysql_db_query() has been a deprecated function for some time now, 
mysql_query() is recommended.

Hope this gets you going - Miles Thompson

At 01:33 AM 1/11/2002 +1100, Necro wrote:
Lo all,

Slight problem on an auth script...


Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104


Line 26:  define( DATABASE, imanager );
Line 103: $arg = select password, 1 as auth from acl where
username='$username' and password=MD5('$username','$password');
Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));


Can anyone help get this to work??

Thankyou.

Andrew


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Yeh, I notice now the MD5 was wrong.

But I still get the same error on line 104. If I try and replace it with the
current query function then I get two errors.

e.g.
Warning: Supplied argument is not a valid MySQL-Link resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Andrew


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:05 AM
To: Necro; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource



The use of the MD5 function in the query doesn't look quite right.
Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
concatenating?

Also, mysql_db_query() has been a deprecated function for some time now,
mysql_query() is recommended.

Hope this gets you going - Miles Thompson

At 01:33 AM 1/11/2002 +1100, Necro wrote:
Lo all,

Slight problem on an auth script...


Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104


Line 26:  define( DATABASE, imanager );
Line 103: $arg = select password, 1 as auth from acl where
username='$username' and password=MD5('$username','$password');
Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));


Can anyone help get this to work??

Thankyou.

Andrew


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Miles Thompson

Break up the code.

I assume you are connecting to the database with mysql_connect()  or 
mysql_pconnect(). If not, do that.

Echo your query so that you know it contains valid values.

Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
into
$result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() );
$row = mysql_fetch_array($result) )
then do whatever processing you need with the array $row.

Miles

PS Just reply to the list, if you reply directly to me I have one more 
message to delete. g /mt

At 02:10 AM 1/11/2002 +1100, Necro wrote:
Yeh, I notice now the MD5 was wrong.

But I still get the same error on line 104. If I try and replace it with the
current query function then I get two errors.

e.g.
Warning: Supplied argument is not a valid MySQL-Link resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Andrew


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:05 AM
To: Necro; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource



The use of the MD5 function in the query doesn't look quite right.
Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
concatenating?

Also, mysql_db_query() has been a deprecated function for some time now,
mysql_query() is recommended.

Hope this gets you going - Miles Thompson

At 01:33 AM 1/11/2002 +1100, Necro wrote:
 Lo all,
 
 Slight problem on an auth script...
 
 
 Warning: Supplied argument is not a valid MySQL result resource in
 d:\htdocs\infekt\packages\auth.inc on line 104
 
 
 Line 26:  define( DATABASE, imanager );
 Line 103: $arg = select password, 1 as auth from acl where
 username='$username' and password=MD5('$username','$password');
 Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 
 
 Can anyone help get this to work??
 
 Thankyou.
 
 Andrew
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Ok,
I have tried a few things now. I finally got it to echo the errors, firstly
there was still a prob with MD5 values being in the apostrophes.
Then next error was no db was selected. So i added a mysql_select_db
statement.
Now i get this:

1109 : Unknown table 'andrewd' in where clause

andrewd being the username I am trying to get it to accept.

Following lines are the current bit:
$arg = select password, 1 as auth from acl where username='$username' and
password=MD5($username.$password);
$result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() );
$row = mysql_fetch_array($result);

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:36 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Break up the code.

I assume you are connecting to the database with mysql_connect()  or
mysql_pconnect(). If not, do that.

Echo your query so that you know it contains valid values.

Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
into
$result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() );
$row = mysql_fetch_array($result) )
then do whatever processing you need with the array $row.

Miles

PS Just reply to the list, if you reply directly to me I have one more
message to delete. g /mt

At 02:10 AM 1/11/2002 +1100, Necro wrote:
Yeh, I notice now the MD5 was wrong.

But I still get the same error on line 104. If I try and replace it with
the
current query function then I get two errors.

e.g.
Warning: Supplied argument is not a valid MySQL-Link resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Andrew


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:05 AM
To: Necro; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource



The use of the MD5 function in the query doesn't look quite right.
Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
concatenating?

Also, mysql_db_query() has been a deprecated function for some time now,
mysql_query() is recommended.

Hope this gets you going - Miles Thompson

At 01:33 AM 1/11/2002 +1100, Necro wrote:
 Lo all,
 
 Slight problem on an auth script...
 
 
 Warning: Supplied argument is not a valid MySQL result resource in
 d:\htdocs\infekt\packages\auth.inc on line 104
 
 
 Line 26:  define( DATABASE, imanager );
 Line 103: $arg = select password, 1 as auth from acl where
 username='$username' and password=MD5('$username','$password');
 Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 
 
 Can anyone help get this to work??
 
 Thankyou.
 
 Andrew
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Miles Thompson

Can you try this puppy at the MySQL console? I'd dearly love to know where 
andrewd is coming from, it sounds like your username.

Before executing mysql_query(), echo $arg and see what it prints.

This is strange, but better than what we had - Miles Thompson

At 02:54 AM 1/11/2002 +1100, Necro wrote:
Ok,
I have tried a few things now. I finally got it to echo the errors, firstly
there was still a prob with MD5 values being in the apostrophes.
Then next error was no db was selected. So i added a mysql_select_db
statement.
Now i get this:

1109 : Unknown table 'andrewd' in where clause

andrewd being the username I am trying to get it to accept.

Following lines are the current bit:
 $arg = select password, 1 as auth from acl where 
 username='$username' and
password=MD5($username.$password);
 $result = mysql_query( $arg ) or die(mysql_errno(). : . 
 mysql_error() );
 $row = mysql_fetch_array($result);

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:36 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Break up the code.

I assume you are connecting to the database with mysql_connect()  or
mysql_pconnect(). If not, do that.

Echo your query so that you know it contains valid values.

Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
into
$result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() );
$row = mysql_fetch_array($result) )
then do whatever processing you need with the array $row.

Miles

PS Just reply to the list, if you reply directly to me I have one more
message to delete. g /mt

At 02:10 AM 1/11/2002 +1100, Necro wrote:
 Yeh, I notice now the MD5 was wrong.
 
 But I still get the same error on line 104. If I try and replace it with
the
 current query function then I get two errors.
 
 e.g.
 Warning: Supplied argument is not a valid MySQL-Link resource in
 d:\htdocs\infekt\packages\auth.inc on line 104
 
 Warning: Supplied argument is not a valid MySQL result resource in
 d:\htdocs\infekt\packages\auth.inc on line 104
 
 Andrew
 
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:05 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL Result Resource
 
 
 
 The use of the MD5 function in the query doesn't look quite right.
 Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
 concatenating?
 
 Also, mysql_db_query() has been a deprecated function for some time now,
 mysql_query() is recommended.
 
 Hope this gets you going - Miles Thompson
 
 At 01:33 AM 1/11/2002 +1100, Necro wrote:
  Lo all,
  
  Slight problem on an auth script...
  
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  
  Line 26:  define( DATABASE, imanager );
  Line 103: $arg = select password, 1 as auth from acl where
  username='$username' and password=MD5('$username','$password');
  Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
  
  
  Can anyone help get this to work??
  
  Thankyou.
  
  Andrew
  
  
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Yep,

andrewd is the username im trying to get this script to work with, its an
authentication script..

The result of echo $arg is the following:

select password, 1 as auth from acl where username='andrewd' and
password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where clause

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:08 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Can you try this puppy at the MySQL console? I'd dearly love to know where
andrewd is coming from, it sounds like your username.

Before executing mysql_query(), echo $arg and see what it prints.

This is strange, but better than what we had - Miles Thompson

At 02:54 AM 1/11/2002 +1100, Necro wrote:
Ok,
I have tried a few things now. I finally got it to echo the errors, firstly
there was still a prob with MD5 values being in the apostrophes.
Then next error was no db was selected. So i added a mysql_select_db
statement.
Now i get this:

1109 : Unknown table 'andrewd' in where clause

andrewd being the username I am trying to get it to accept.

Following lines are the current bit:
 $arg = select password, 1 as auth from acl where
 username='$username' and
password=MD5($username.$password);
 $result = mysql_query( $arg ) or die(mysql_errno(). : .
 mysql_error() );
 $row = mysql_fetch_array($result);

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:36 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Break up the code.

I assume you are connecting to the database with mysql_connect()  or
mysql_pconnect(). If not, do that.

Echo your query so that you know it contains valid values.

Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
into
$result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() );
$row = mysql_fetch_array($result) )
then do whatever processing you need with the array $row.

Miles

PS Just reply to the list, if you reply directly to me I have one more
message to delete. g /mt

At 02:10 AM 1/11/2002 +1100, Necro wrote:
 Yeh, I notice now the MD5 was wrong.
 
 But I still get the same error on line 104. If I try and replace it with
the
 current query function then I get two errors.
 
 e.g.
 Warning: Supplied argument is not a valid MySQL-Link resource in
 d:\htdocs\infekt\packages\auth.inc on line 104
 
 Warning: Supplied argument is not a valid MySQL result resource in
 d:\htdocs\infekt\packages\auth.inc on line 104
 
 Andrew
 
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:05 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL Result Resource
 
 
 
 The use of the MD5 function in the query doesn't look quite right.
 Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
 concatenating?
 
 Also, mysql_db_query() has been a deprecated function for some time now,
 mysql_query() is recommended.
 
 Hope this gets you going - Miles Thompson
 
 At 01:33 AM 1/11/2002 +1100, Necro wrote:
  Lo all,
  
  Slight problem on an auth script...
  
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  
  Line 26:  define( DATABASE, imanager );
  Line 103: $arg = select password, 1 as auth from acl where
  username='$username' and password=MD5('$username','$password');
  Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
  
  
  Can anyone help get this to work??
  
  Thankyou.
  
  Andrew
  
  
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
[EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL Result Resource

2002-01-10 Thread George Pitcher

I was having something similar and solved it by wrapping the column names in
parentheses:

select password, 1 as auth from acl where (username='andrewd' and
 password=MD5(andrewd.madonna));

It might help. or eliminate something if I'm not right.

George
- Original Message -
From: Necro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 4:09 PM
Subject: RE: [PHP-DB] MySQL Result Resource


 Yep,

 andrewd is the username im trying to get this script to work with, its an
 authentication script..

 The result of echo $arg is the following:

 select password, 1 as auth from acl where username='andrewd' and
 password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where
clause

 Andrew

 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 3:08 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource


 Can you try this puppy at the MySQL console? I'd dearly love to know where
 andrewd is coming from, it sounds like your username.

 Before executing mysql_query(), echo $arg and see what it prints.

 This is strange, but better than what we had - Miles Thompson

 At 02:54 AM 1/11/2002 +1100, Necro wrote:
 Ok,
 I have tried a few things now. I finally got it to echo the errors,
firstly
 there was still a prob with MD5 values being in the apostrophes.
 Then next error was no db was selected. So i added a mysql_select_db
 statement.
 Now i get this:
 
 1109 : Unknown table 'andrewd' in where clause
 
 andrewd being the username I am trying to get it to accept.
 
 Following lines are the current bit:
  $arg = select password, 1 as auth from acl where
  username='$username' and
 password=MD5($username.$password);
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
  mysql_error() );
  $row = mysql_fetch_array($result);
 
 Andrew
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:36 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
 Break up the code.
 
 I assume you are connecting to the database with mysql_connect()  or
 mysql_pconnect(). If not, do that.
 
 Echo your query so that you know it contains valid values.
 
 Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 into
 $result = mysql_query( $arg ) or die(mysql_errno(). : .
mysql_error() );
 $row = mysql_fetch_array($result) )
 then do whatever processing you need with the array $row.
 
 Miles
 
 PS Just reply to the list, if you reply directly to me I have one more
 message to delete. g /mt
 
 At 02:10 AM 1/11/2002 +1100, Necro wrote:
  Yeh, I notice now the MD5 was wrong.
  
  But I still get the same error on line 104. If I try and replace it
with
 the
  current query function then I get two errors.
  
  e.g.
  Warning: Supplied argument is not a valid MySQL-Link resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Andrew
  
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:05 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MySQL Result Resource
  
  
  
  The use of the MD5 function in the query doesn't look quite right.
  Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
  concatenating?
  
  Also, mysql_db_query() has been a deprecated function for some time
now,
  mysql_query() is recommended.
  
  Hope this gets you going - Miles Thompson
  
  At 01:33 AM 1/11/2002 +1100, Necro wrote:
   Lo all,
   
   Slight problem on an auth script...
   
   
   Warning: Supplied argument is not a valid MySQL result resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   
   Line 26:  define( DATABASE, imanager );
   Line 103: $arg = select password, 1 as auth from acl where
   username='$username' and password=MD5('$username','$password');
   Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
   
   
   Can anyone help get this to work??
   
   Thankyou.
   
   Andrew
   
   
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED

RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Same error...

select password, 1 as auth from acl where (username='andrewd' and
password=MD5(andrewd.madonna))1109 : Unknown table 'andrewd' in where clause

Andrew

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:10 AM
To: Necro; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource


I was having something similar and solved it by wrapping the column names in
parentheses:

select password, 1 as auth from acl where (username='andrewd' and
 password=MD5(andrewd.madonna));

It might help. or eliminate something if I'm not right.

George
- Original Message -
From: Necro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 4:09 PM
Subject: RE: [PHP-DB] MySQL Result Resource


 Yep,

 andrewd is the username im trying to get this script to work with, its an
 authentication script..

 The result of echo $arg is the following:

 select password, 1 as auth from acl where username='andrewd' and
 password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where
clause

 Andrew

 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 3:08 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource


 Can you try this puppy at the MySQL console? I'd dearly love to know where
 andrewd is coming from, it sounds like your username.

 Before executing mysql_query(), echo $arg and see what it prints.

 This is strange, but better than what we had - Miles Thompson

 At 02:54 AM 1/11/2002 +1100, Necro wrote:
 Ok,
 I have tried a few things now. I finally got it to echo the errors,
firstly
 there was still a prob with MD5 values being in the apostrophes.
 Then next error was no db was selected. So i added a mysql_select_db
 statement.
 Now i get this:
 
 1109 : Unknown table 'andrewd' in where clause
 
 andrewd being the username I am trying to get it to accept.
 
 Following lines are the current bit:
  $arg = select password, 1 as auth from acl where
  username='$username' and
 password=MD5($username.$password);
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
  mysql_error() );
  $row = mysql_fetch_array($result);
 
 Andrew
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:36 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
 Break up the code.
 
 I assume you are connecting to the database with mysql_connect()  or
 mysql_pconnect(). If not, do that.
 
 Echo your query so that you know it contains valid values.
 
 Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 into
 $result = mysql_query( $arg ) or die(mysql_errno(). : .
mysql_error() );
 $row = mysql_fetch_array($result) )
 then do whatever processing you need with the array $row.
 
 Miles
 
 PS Just reply to the list, if you reply directly to me I have one more
 message to delete. g /mt
 
 At 02:10 AM 1/11/2002 +1100, Necro wrote:
  Yeh, I notice now the MD5 was wrong.
  
  But I still get the same error on line 104. If I try and replace it
with
 the
  current query function then I get two errors.
  
  e.g.
  Warning: Supplied argument is not a valid MySQL-Link resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Andrew
  
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:05 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MySQL Result Resource
  
  
  
  The use of the MD5 function in the query doesn't look quite right.
  Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
  concatenating?
  
  Also, mysql_db_query() has been a deprecated function for some time
now,
  mysql_query() is recommended.
  
  Hope this gets you going - Miles Thompson
  
  At 01:33 AM 1/11/2002 +1100, Necro wrote:
   Lo all,
   
   Slight problem on an auth script...
   
   
   Warning: Supplied argument is not a valid MySQL result resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   
   Line 26:  define( DATABASE, imanager );
   Line 103: $arg = select password, 1 as auth from acl where
   username='$username' and password=MD5('$username','$password');
   Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
   
   
   Can anyone help get this to work??
   
   Thankyou.
   
   Andrew
   
   
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 --
 PHP

Re: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Andrey Hristov

try this :

select password, 1 as auth from acl where (username='andrewd' and 
password=MD5(andrewd.madonna));
- Original Message - 
From: Necro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 6:18 PM
Subject: RE: [PHP-DB] MySQL Result Resource


 Same error...
 
 select password, 1 as auth from acl where (username='andrewd' and
 password=MD5(andrewd.madonna))1109 : Unknown table 'andrewd' in where clause
 
 Andrew
 
 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 3:10 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL Result Resource
 
 
 I was having something similar and solved it by wrapping the column names in
 parentheses:
 
 select password, 1 as auth from acl where (username='andrewd' and
  password=MD5(andrewd.madonna));
 
 It might help. or eliminate something if I'm not right.
 
 George
 - Original Message -
 From: Necro [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, January 10, 2002 4:09 PM
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
  Yep,
 
  andrewd is the username im trying to get this script to work with, its an
  authentication script..
 
  The result of echo $arg is the following:
 
  select password, 1 as auth from acl where username='andrewd' and
  password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where
 clause
 
  Andrew
 
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 3:08 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] MySQL Result Resource
 
 
  Can you try this puppy at the MySQL console? I'd dearly love to know where
  andrewd is coming from, it sounds like your username.
 
  Before executing mysql_query(), echo $arg and see what it prints.
 
  This is strange, but better than what we had - Miles Thompson
 
  At 02:54 AM 1/11/2002 +1100, Necro wrote:
  Ok,
  I have tried a few things now. I finally got it to echo the errors,
 firstly
  there was still a prob with MD5 values being in the apostrophes.
  Then next error was no db was selected. So i added a mysql_select_db
  statement.
  Now i get this:
  
  1109 : Unknown table 'andrewd' in where clause
  
  andrewd being the username I am trying to get it to accept.
  
  Following lines are the current bit:
   $arg = select password, 1 as auth from acl where
   username='$username' and
  password=MD5($username.$password);
   $result = mysql_query( $arg ) or die(mysql_errno(). : .
   mysql_error() );
   $row = mysql_fetch_array($result);
  
  Andrew
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:36 AM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] MySQL Result Resource
  
  
  Break up the code.
  
  I assume you are connecting to the database with mysql_connect()  or
  mysql_pconnect(). If not, do that.
  
  Echo your query so that you know it contains valid values.
  
  Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
  into
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
 mysql_error() );
  $row = mysql_fetch_array($result) )
  then do whatever processing you need with the array $row.
  
  Miles
  
  PS Just reply to the list, if you reply directly to me I have one more
  message to delete. g /mt
  
  At 02:10 AM 1/11/2002 +1100, Necro wrote:
   Yeh, I notice now the MD5 was wrong.
   
   But I still get the same error on line 104. If I try and replace it
 with
  the
   current query function then I get two errors.
   
   e.g.
   Warning: Supplied argument is not a valid MySQL-Link resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   Warning: Supplied argument is not a valid MySQL result resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   Andrew
   
   
   -Original Message-
   From: Miles Thompson [mailto:[EMAIL PROTECTED]]
   Sent: Friday, 11 January 2002 2:05 AM
   To: Necro; [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] MySQL Result Resource
   
   
   
   The use of the MD5 function in the query doesn't look quite right.
   Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
   concatenating?
   
   Also, mysql_db_query() has been a deprecated function for some time
 now,
   mysql_query() is recommended.
   
   Hope this gets you going - Miles Thompson
   
   At 01:33 AM 1/11/2002 +1100, Necro wrote:
Lo all,

Slight problem on an auth script...


Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104


Line 26:  define( DATABASE, imanager );
Line 103: $arg = select password, 1 as auth from acl where
username='$username' and password=MD5('$username','$password');
Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));


Can anyone help get this to work??

Thankyou.

Andrew

RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Miles Thompson


LIGHT just came on!!! Why does ittake so long.

MD5(andrew.madonna) - I think you're goint to have to do this
$passhash = $username . $password

and use MD5($passhash).

MySQL is looking for a table andrewd with the field madonna in the way 
the MD5() is presently structured.

Go to it - Miles

At 03:09 AM 1/11/2002 +1100, Necro wrote:
Yep,

andrewd is the username im trying to get this script to work with, its an
authentication script..

The result of echo $arg is the following:

select password, 1 as auth from acl where username='andrewd' and
password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where clause

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:08 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Can you try this puppy at the MySQL console? I'd dearly love to know where
andrewd is coming from, it sounds like your username.

Before executing mysql_query(), echo $arg and see what it prints.

This is strange, but better than what we had - Miles Thompson

At 02:54 AM 1/11/2002 +1100, Necro wrote:
 Ok,
 I have tried a few things now. I finally got it to echo the errors, firstly
 there was still a prob with MD5 values being in the apostrophes.
 Then next error was no db was selected. So i added a mysql_select_db
 statement.
 Now i get this:
 
 1109 : Unknown table 'andrewd' in where clause
 
 andrewd being the username I am trying to get it to accept.
 
 Following lines are the current bit:
  $arg = select password, 1 as auth from acl where
  username='$username' and
 password=MD5($username.$password);
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
  mysql_error() );
  $row = mysql_fetch_array($result);
 
 Andrew
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:36 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
 Break up the code.
 
 I assume you are connecting to the database with mysql_connect()  or
 mysql_pconnect(). If not, do that.
 
 Echo your query so that you know it contains valid values.
 
 Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 into
 $result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() );
 $row = mysql_fetch_array($result) )
 then do whatever processing you need with the array $row.
 
 Miles
 
 PS Just reply to the list, if you reply directly to me I have one more
 message to delete. g /mt
 
 At 02:10 AM 1/11/2002 +1100, Necro wrote:
  Yeh, I notice now the MD5 was wrong.
  
  But I still get the same error on line 104. If I try and replace it with
 the
  current query function then I get two errors.
  
  e.g.
  Warning: Supplied argument is not a valid MySQL-Link resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Andrew
  
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:05 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MySQL Result Resource
  
  
  
  The use of the MD5 function in the query doesn't look quite right.
  Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
  concatenating?
  
  Also, mysql_db_query() has been a deprecated function for some time now,
  mysql_query() is recommended.
  
  Hope this gets you going - Miles Thompson
  
  At 01:33 AM 1/11/2002 +1100, Necro wrote:
   Lo all,
   
   Slight problem on an auth script...
   
   
   Warning: Supplied argument is not a valid MySQL result resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   
   Line 26:  define( DATABASE, imanager );
   Line 103: $arg = select password, 1 as auth from acl where
   username='$username' and password=MD5('$username','$password');
   Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
   
   
   Can anyone help get this to work??
   
   Thankyou.
   
   Andrew
   
   
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
[EMAIL PROTECTED]
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http

RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Parse error: parse error in d:\htdocs\infekt\packages\auth.inc on line 104

$arg = select password, 1 as auth from acl where (username='andrewd' and
password=MD5(andrewd.madonna));

Nope  :(



-Original Message-
From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:28 AM
To: Necro
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource


try this :

select password, 1 as auth from acl where (username='andrewd' and
password=MD5(andrewd.madonna));
- Original Message -
From: Necro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 6:18 PM
Subject: RE: [PHP-DB] MySQL Result Resource


 Same error...

 select password, 1 as auth from acl where (username='andrewd' and
 password=MD5(andrewd.madonna))1109 : Unknown table 'andrewd' in where
clause

 Andrew

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 3:10 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL Result Resource


 I was having something similar and solved it by wrapping the column names
in
 parentheses:

 select password, 1 as auth from acl where (username='andrewd' and
  password=MD5(andrewd.madonna));

 It might help. or eliminate something if I'm not right.

 George
 - Original Message -
 From: Necro [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, January 10, 2002 4:09 PM
 Subject: RE: [PHP-DB] MySQL Result Resource


  Yep,
 
  andrewd is the username im trying to get this script to work with, its
an
  authentication script..
 
  The result of echo $arg is the following:
 
  select password, 1 as auth from acl where username='andrewd' and
  password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where
 clause
 
  Andrew
 
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 3:08 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] MySQL Result Resource
 
 
  Can you try this puppy at the MySQL console? I'd dearly love to know
where
  andrewd is coming from, it sounds like your username.
 
  Before executing mysql_query(), echo $arg and see what it prints.
 
  This is strange, but better than what we had - Miles Thompson
 
  At 02:54 AM 1/11/2002 +1100, Necro wrote:
  Ok,
  I have tried a few things now. I finally got it to echo the errors,
 firstly
  there was still a prob with MD5 values being in the apostrophes.
  Then next error was no db was selected. So i added a mysql_select_db
  statement.
  Now i get this:
  
  1109 : Unknown table 'andrewd' in where clause
  
  andrewd being the username I am trying to get it to accept.
  
  Following lines are the current bit:
   $arg = select password, 1 as auth from acl where
   username='$username' and
  password=MD5($username.$password);
   $result = mysql_query( $arg ) or die(mysql_errno(). : .
   mysql_error() );
   $row = mysql_fetch_array($result);
  
  Andrew
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:36 AM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] MySQL Result Resource
  
  
  Break up the code.
  
  I assume you are connecting to the database with mysql_connect()  or
  mysql_pconnect(). If not, do that.
  
  Echo your query so that you know it contains valid values.
  
  Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
  into
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
 mysql_error() );
  $row = mysql_fetch_array($result) )
  then do whatever processing you need with the array $row.
  
  Miles
  
  PS Just reply to the list, if you reply directly to me I have one more
  message to delete. g /mt
  
  At 02:10 AM 1/11/2002 +1100, Necro wrote:
   Yeh, I notice now the MD5 was wrong.
   
   But I still get the same error on line 104. If I try and replace it
 with
  the
   current query function then I get two errors.
   
   e.g.
   Warning: Supplied argument is not a valid MySQL-Link resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   Warning: Supplied argument is not a valid MySQL result resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   Andrew
   
   
   -Original Message-
   From: Miles Thompson [mailto:[EMAIL PROTECTED]]
   Sent: Friday, 11 January 2002 2:05 AM
   To: Necro; [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] MySQL Result Resource
   
   
   
   The use of the MD5 function in the query doesn't look quite right.
   Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
   concatenating?
   
   Also, mysql_db_query() has been a deprecated function for some time
 now,
   mysql_query() is recommended.
   
   Hope this gets you going - Miles Thompson
   
   At 01:33 AM 1/11/2002 +1100, Necro wrote:
Lo all,

Slight problem on an auth script...


Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc

RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Miles,

You must MD5 the value outside of mysql for it to evaluate it, from the
error I just got.
i have tried
$passhash = MD5($username.$password);
$arg = select password, 1 as auth from acl where (username='andrewd' and
password=($passhash));

And get the following error...
select password, 1 as auth from acl where (username='andrewd' and
password=(c59d088cd3d873af5239cfac1234f370))1054 : Unknown column
'c59d088cd3d873af5239cfac1234f370' in 'where clause'

So at least the MD5 is now evaluated. But there is still and error in there.

Andrew


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:29 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource



LIGHT just came on!!! Why does ittake so long.

MD5(andrew.madonna) - I think you're goint to have to do this
$passhash = $username . $password

and use MD5($passhash).

MySQL is looking for a table andrewd with the field madonna in the way
the MD5() is presently structured.

Go to it - Miles

At 03:09 AM 1/11/2002 +1100, Necro wrote:
Yep,

andrewd is the username im trying to get this script to work with, its an
authentication script..

The result of echo $arg is the following:

select password, 1 as auth from acl where username='andrewd' and
password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where clause

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:08 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Can you try this puppy at the MySQL console? I'd dearly love to know where
andrewd is coming from, it sounds like your username.

Before executing mysql_query(), echo $arg and see what it prints.

This is strange, but better than what we had - Miles Thompson

At 02:54 AM 1/11/2002 +1100, Necro wrote:
 Ok,
 I have tried a few things now. I finally got it to echo the errors,
firstly
 there was still a prob with MD5 values being in the apostrophes.
 Then next error was no db was selected. So i added a mysql_select_db
 statement.
 Now i get this:
 
 1109 : Unknown table 'andrewd' in where clause
 
 andrewd being the username I am trying to get it to accept.
 
 Following lines are the current bit:
  $arg = select password, 1 as auth from acl where
  username='$username' and
 password=MD5($username.$password);
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
  mysql_error() );
  $row = mysql_fetch_array($result);
 
 Andrew
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:36 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
 Break up the code.
 
 I assume you are connecting to the database with mysql_connect()  or
 mysql_pconnect(). If not, do that.
 
 Echo your query so that you know it contains valid values.
 
 Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 into
 $result = mysql_query( $arg ) or die(mysql_errno(). : .
mysql_error() );
 $row = mysql_fetch_array($result) )
 then do whatever processing you need with the array $row.
 
 Miles
 
 PS Just reply to the list, if you reply directly to me I have one more
 message to delete. g /mt
 
 At 02:10 AM 1/11/2002 +1100, Necro wrote:
  Yeh, I notice now the MD5 was wrong.
  
  But I still get the same error on line 104. If I try and replace it
with
 the
  current query function then I get two errors.
  
  e.g.
  Warning: Supplied argument is not a valid MySQL-Link resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Andrew
  
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:05 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MySQL Result Resource
  
  
  
  The use of the MD5 function in the query doesn't look quite right.
  Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
  concatenating?
  
  Also, mysql_db_query() has been a deprecated function for some time
now,
  mysql_query() is recommended.
  
  Hope this gets you going - Miles Thompson
  
  At 01:33 AM 1/11/2002 +1100, Necro wrote:
   Lo all,
   
   Slight problem on an auth script...
   
   
   Warning: Supplied argument is not a valid MySQL result resource in
   d:\htdocs\infekt\packages\auth.inc on line 104
   
   
   Line 26:  define( DATABASE, imanager );
   Line 103: $arg = select password, 1 as auth from acl where
   username='$username' and password=MD5('$username','$password');
   Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
   
   
   Can anyone help get this to work??
   
   Thankyou.
   
   Andrew
   
   
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact

RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

On further investigation it appears to get the correct MD5 value the correct
synatx is:

$passhash = MD5($username.$password);   --- needs the 

The the error resulting from this is:

select password, 1 as auth from acl where (username='andrewd' and
password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in your
SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1

Does that help give any idea at all as to what the problem is?

Andrew

-Original Message-
From: Necro [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:35 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Miles,

You must MD5 the value outside of mysql for it to evaluate it, from the
error I just got.
i have tried
$passhash = MD5($username.$password);
$arg = select password, 1 as auth from acl where (username='andrewd' and
password=($passhash));

And get the following error...
select password, 1 as auth from acl where (username='andrewd' and
password=(c59d088cd3d873af5239cfac1234f370))1054 : Unknown column
'c59d088cd3d873af5239cfac1234f370' in 'where clause'

So at least the MD5 is now evaluated. But there is still and error in there.

Andrew


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:29 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource



LIGHT just came on!!! Why does ittake so long.

MD5(andrew.madonna) - I think you're goint to have to do this
$passhash = $username . $password

and use MD5($passhash).

MySQL is looking for a table andrewd with the field madonna in the way
the MD5() is presently structured.

Go to it - Miles

At 03:09 AM 1/11/2002 +1100, Necro wrote:
Yep,

andrewd is the username im trying to get this script to work with, its an
authentication script..

The result of echo $arg is the following:

select password, 1 as auth from acl where username='andrewd' and
password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where clause

Andrew

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:08 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Can you try this puppy at the MySQL console? I'd dearly love to know where
andrewd is coming from, it sounds like your username.

Before executing mysql_query(), echo $arg and see what it prints.

This is strange, but better than what we had - Miles Thompson

At 02:54 AM 1/11/2002 +1100, Necro wrote:
 Ok,
 I have tried a few things now. I finally got it to echo the errors,
firstly
 there was still a prob with MD5 values being in the apostrophes.
 Then next error was no db was selected. So i added a mysql_select_db
 statement.
 Now i get this:
 
 1109 : Unknown table 'andrewd' in where clause
 
 andrewd being the username I am trying to get it to accept.
 
 Following lines are the current bit:
  $arg = select password, 1 as auth from acl where
  username='$username' and
 password=MD5($username.$password);
  $result = mysql_query( $arg ) or die(mysql_errno(). : .
  mysql_error() );
  $row = mysql_fetch_array($result);
 
 Andrew
 
 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 2:36 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
 Break up the code.
 
 I assume you are connecting to the database with mysql_connect()  or
 mysql_pconnect(). If not, do that.
 
 Echo your query so that you know it contains valid values.
 
 Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
 into
 $result = mysql_query( $arg ) or die(mysql_errno(). : .
mysql_error() );
 $row = mysql_fetch_array($result) )
 then do whatever processing you need with the array $row.
 
 Miles
 
 PS Just reply to the list, if you reply directly to me I have one more
 message to delete. g /mt
 
 At 02:10 AM 1/11/2002 +1100, Necro wrote:
  Yeh, I notice now the MD5 was wrong.
  
  But I still get the same error on line 104. If I try and replace it
with
 the
  current query function then I get two errors.
  
  e.g.
  Warning: Supplied argument is not a valid MySQL-Link resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Warning: Supplied argument is not a valid MySQL result resource in
  d:\htdocs\infekt\packages\auth.inc on line 104
  
  Andrew
  
  
  -Original Message-
  From: Miles Thompson [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 2:05 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MySQL Result Resource
  
  
  
  The use of the MD5 function in the query doesn't look quite right.
  Shouldn't it be MD5('$password')  or MD5('$username'.'$password') if
  concatenating?
  
  Also, mysql_db_query() has been a deprecated function for some time
now,
  mysql_query() is recommended.
  
  Hope this gets you going - Miles Thompson
  
  At 01:33 AM 1/11/2002 +1100, Necro wrote:
   Lo all,
   
   Slight problem on an auth script

Re: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Andrey Hristov

try : 
$arg = select password, 1 as auth from acl where (username='andrewd') and 
password=MD5(concat(username,password));

HTH

Andrey
- Original Message - 
From: Necro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 6:29 PM
Subject: RE: [PHP-DB] MySQL Result Resource


 Parse error: parse error in d:\htdocs\infekt\packages\auth.inc on line 104
 
 $arg = select password, 1 as auth from acl where (username='andrewd' and
 password=MD5(andrewd.madonna));
 
 Nope  :(
 
 
 
 -Original Message-
 From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 3:28 AM
 To: Necro
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL Result Resource
 
 
 try this :
 
 select password, 1 as auth from acl where (username='andrewd' and
 password=MD5(andrewd.madonna));
 - Original Message -
 From: Necro [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, January 10, 2002 6:18 PM
 Subject: RE: [PHP-DB] MySQL Result Resource
 
 
  Same error...
 
  select password, 1 as auth from acl where (username='andrewd' and
  password=MD5(andrewd.madonna))1109 : Unknown table 'andrewd' in where
 clause
 
  Andrew
 
  -Original Message-
  From: George Pitcher [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 11 January 2002 3:10 AM
  To: Necro; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MySQL Result Resource
 
 
  I was having something similar and solved it by wrapping the column names
 in
  parentheses:
 
  select password, 1 as auth from acl where (username='andrewd' and
   password=MD5(andrewd.madonna));
 
  It might help. or eliminate something if I'm not right.
 
  George
  - Original Message -
  From: Necro [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, January 10, 2002 4:09 PM
  Subject: RE: [PHP-DB] MySQL Result Resource
 
 
   Yep,
  
   andrewd is the username im trying to get this script to work with, its
 an
   authentication script..
  
   The result of echo $arg is the following:
  
   select password, 1 as auth from acl where username='andrewd' and
   password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where
  clause
  
   Andrew
  
   -Original Message-
   From: Miles Thompson [mailto:[EMAIL PROTECTED]]
   Sent: Friday, 11 January 2002 3:08 AM
   To: Necro; [EMAIL PROTECTED]
   Subject: RE: [PHP-DB] MySQL Result Resource
  
  
   Can you try this puppy at the MySQL console? I'd dearly love to know
 where
   andrewd is coming from, it sounds like your username.
  
   Before executing mysql_query(), echo $arg and see what it prints.
  
   This is strange, but better than what we had - Miles Thompson
  
   At 02:54 AM 1/11/2002 +1100, Necro wrote:
   Ok,
   I have tried a few things now. I finally got it to echo the errors,
  firstly
   there was still a prob with MD5 values being in the apostrophes.
   Then next error was no db was selected. So i added a mysql_select_db
   statement.
   Now i get this:
   
   1109 : Unknown table 'andrewd' in where clause
   
   andrewd being the username I am trying to get it to accept.
   
   Following lines are the current bit:
$arg = select password, 1 as auth from acl where
username='$username' and
   password=MD5($username.$password);
$result = mysql_query( $arg ) or die(mysql_errno(). : .
mysql_error() );
$row = mysql_fetch_array($result);
   
   Andrew
   
   -Original Message-
   From: Miles Thompson [mailto:[EMAIL PROTECTED]]
   Sent: Friday, 11 January 2002 2:36 AM
   To: [EMAIL PROTECTED]
   Subject: RE: [PHP-DB] MySQL Result Resource
   
   
   Break up the code.
   
   I assume you are connecting to the database with mysql_connect()  or
   mysql_pconnect(). If not, do that.
   
   Echo your query so that you know it contains valid values.
   
   Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
   into
   $result = mysql_query( $arg ) or die(mysql_errno(). : .
  mysql_error() );
   $row = mysql_fetch_array($result) )
   then do whatever processing you need with the array $row.
   
   Miles
   
   PS Just reply to the list, if you reply directly to me I have one more
   message to delete. g /mt
   
   At 02:10 AM 1/11/2002 +1100, Necro wrote:
Yeh, I notice now the MD5 was wrong.

But I still get the same error on line 104. If I try and replace it
  with
   the
current query function then I get two errors.

e.g.
Warning: Supplied argument is not a valid MySQL-Link resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Warning: Supplied argument is not a valid MySQL result resource in
d:\htdocs\infekt\packages\auth.inc on line 104

Andrew


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:05 AM
To: Necro; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource



The use of the MD5 function in the query doesn't look quite right

RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread php3

Addressed to: Necro [EMAIL PROTECTED]
  [EMAIL PROTECTED]

** Reply to note from Necro [EMAIL PROTECTED] Fri, 11 Jan 2002 03:41:43 +1100
 select password, 1 as auth from acl where (username='andrewd' and
 password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in your
 SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1

 Does that help give any idea at all as to what the problem is?



There are no quotes around  163e06103a371fd95b21b4a849bb4b91  The
error occurs where it does because '163e06103' is a valid exponential
notation value for a nubmer, but having an 'a' follow it is not valid.


My solution would be:


$Pass = md5( whatever ); #  I don't care if you hash just the password
 #  or the username and password as long as
 #  you do it the same way as you entered
 #  the passwords.

mysql_query( SELECT password, 1 AS auth  .
 FROM acl  .
 WHERE username = '$username'  .
   AND password = '$Pass'  );


But I question what you are doing returning password, so it might work
as well as:

mysql_query( SELECT count(*) as Authorized  .
 FROM acl  .
 WHERE username = '$username'  .
   AND password = '$Pass'  );

This returns 0 or 1 in a field named Authorized depending on if the
password matches or not.


You might also want to look at the MySQL PASSWORD() function and not
mess with md5 at all.

Rick

Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Ok,


I have tried to go to PASSWORD after none of the suggestions worked out.

The current statement is:
$arg = select password, 1 as auth from acl where username='$username' and
password = 'PASSWORD($password)';

But the error I get now is:
select password, 1 as auth from acl where username='andrewd' and password =
'PASSWORD(madonna)'Resource id #2

Any ideas?

Andrew

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 8:56 AM
To: Necro; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Addressed to: Necro [EMAIL PROTECTED]
  [EMAIL PROTECTED]

** Reply to note from Necro [EMAIL PROTECTED] Fri, 11 Jan 2002
03:41:43 +1100
 select password, 1 as auth from acl where (username='andrewd' and
 password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in
your
 SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1

 Does that help give any idea at all as to what the problem is?



There are no quotes around  163e06103a371fd95b21b4a849bb4b91  The
error occurs where it does because '163e06103' is a valid exponential
notation value for a nubmer, but having an 'a' follow it is not valid.


My solution would be:


$Pass = md5( whatever ); #  I don't care if you hash just the password
 #  or the username and password as long as
 #  you do it the same way as you entered
 #  the passwords.

mysql_query( SELECT password, 1 AS auth  .
 FROM acl  .
 WHERE username = '$username'  .
   AND password = '$Pass'  );


But I question what you are doing returning password, so it might work
as well as:

mysql_query( SELECT count(*) as Authorized  .
 FROM acl  .
 WHERE username = '$username'  .
   AND password = '$Pass'  );

This returns 0 or 1 in a field named Authorized depending on if the
password matches or not.


You might also want to look at the MySQL PASSWORD() function and not
mess with md5 at all.

Rick

Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Daniel Barton

Andrew:

Don't put quotes around your MySQL function call.

i.e.

PASSWORD($password)

not

'PASSWORD($password)'

p.s. Looking at this thread, it seems like most of the errors you're encountering have
nothing to do with md5() or password(), but with syntax, like placement of quotes, or
whether they are single quotes or double quotes. I would suggest experimenting with
the syntax a bit, to check out what's kosher, and what's not? Check out the PHP
manual's sections on 'Resource id's - I think you may find it to be very important to
understanding how PHP interacts with databases. Resource ids, which are returned by
quite a few function calls, are not classic variables - they need to be manipulated or
interpreted before you use them.

Cheers,
db



Necro wrote:

 Ok,

 I have tried to go to PASSWORD after none of the suggestions worked out.

 The current statement is:
 $arg = select password, 1 as auth from acl where username='$username' and
 password = 'PASSWORD($password)';

 But the error I get now is:
 select password, 1 as auth from acl where username='andrewd' and password =
 'PASSWORD(madonna)'Resource id #2

 Any ideas?

 Andrew

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 8:56 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource

 Addressed to: Necro [EMAIL PROTECTED]
   [EMAIL PROTECTED]

 ** Reply to note from Necro [EMAIL PROTECTED] Fri, 11 Jan 2002
 03:41:43 +1100
  select password, 1 as auth from acl where (username='andrewd' and
  password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in
 your
  SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1
 
  Does that help give any idea at all as to what the problem is?
 

 There are no quotes around  163e06103a371fd95b21b4a849bb4b91  The
 error occurs where it does because '163e06103' is a valid exponential
 notation value for a nubmer, but having an 'a' follow it is not valid.

 My solution would be:

 $Pass = md5( whatever ); #  I don't care if you hash just the password
  #  or the username and password as long as
  #  you do it the same way as you entered
  #  the passwords.

 mysql_query( SELECT password, 1 AS auth  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 But I question what you are doing returning password, so it might work
 as well as:

 mysql_query( SELECT count(*) as Authorized  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 This returns 0 or 1 in a field named Authorized depending on if the
 password matches or not.

 You might also want to look at the MySQL PASSWORD() function and not
 mess with md5 at all.

 Rick

 Rick Widmer
 Internet Marketing Specialists
 http://www.developersdesk.com

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
--
Dan Barton
Terrestrial Program Biologist
Asst. Data Manager
Point Reyes Bird Observatory
http://www.prbo.org
[EMAIL PROTECTED]
[EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

Daniel,

I had tried both with and without quotes. Neither work.

Without quotes I get:
select password, 1 as auth from acl where username='andrewd' and password =
PASSWORD(madonna)1054 : Unknown column 'madonna' in 'where clause'

Notice that madonna has not been crypted by the PASSWORD call either.

Andrew

-Original Message-
From: Daniel Barton [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:40 PM
To: Necro
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource


Andrew:

Don't put quotes around your MySQL function call.

i.e.

PASSWORD($password)

not

'PASSWORD($password)'

p.s. Looking at this thread, it seems like most of the errors you're
encountering have
nothing to do with md5() or password(), but with syntax, like placement of
quotes, or
whether they are single quotes or double quotes. I would suggest
experimenting with
the syntax a bit, to check out what's kosher, and what's not? Check out the
PHP
manual's sections on 'Resource id's - I think you may find it to be very
important to
understanding how PHP interacts with databases. Resource ids, which are
returned by
quite a few function calls, are not classic variables - they need to be
manipulated or
interpreted before you use them.

Cheers,
db



Necro wrote:

 Ok,

 I have tried to go to PASSWORD after none of the suggestions worked out.

 The current statement is:
 $arg = select password, 1 as auth from acl where
username='$username' and
 password = 'PASSWORD($password)';

 But the error I get now is:
 select password, 1 as auth from acl where username='andrewd' and password
=
 'PASSWORD(madonna)'Resource id #2

 Any ideas?

 Andrew

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 8:56 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource

 Addressed to: Necro [EMAIL PROTECTED]
   [EMAIL PROTECTED]

 ** Reply to note from Necro [EMAIL PROTECTED] Fri, 11 Jan 2002
 03:41:43 +1100
  select password, 1 as auth from acl where (username='andrewd' and
  password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in
 your
  SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1
 
  Does that help give any idea at all as to what the problem is?
 

 There are no quotes around  163e06103a371fd95b21b4a849bb4b91  The
 error occurs where it does because '163e06103' is a valid exponential
 notation value for a nubmer, but having an 'a' follow it is not valid.

 My solution would be:

 $Pass = md5( whatever ); #  I don't care if you hash just the password
  #  or the username and password as long as
  #  you do it the same way as you entered
  #  the passwords.

 mysql_query( SELECT password, 1 AS auth  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 But I question what you are doing returning password, so it might work
 as well as:

 mysql_query( SELECT count(*) as Authorized  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 This returns 0 or 1 in a field named Authorized depending on if the
 password matches or not.

 You might also want to look at the MySQL PASSWORD() function and not
 mess with md5 at all.

 Rick

 Rick Widmer
 Internet Marketing Specialists
 http://www.developersdesk.com

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
--
Dan Barton
Terrestrial Program Biologist
Asst. Data Manager
Point Reyes Bird Observatory
http://www.prbo.org
[EMAIL PROTECTED]
[EMAIL PROTECTED]



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Necro

http://www.hotscripts.com/Detailed/4219.html  --- that is the script

But I cannot use crypt() on a winodws system. So I tried MD5, now I try
PASSWORD.

Any one got any idea how to make the script work with either of those??

Andrew

-Original Message-
From: Necro [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 3:30 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Result Resource


Daniel,

I had tried both with and without quotes. Neither work.

Without quotes I get:
select password, 1 as auth from acl where username='andrewd' and password =
PASSWORD(madonna)1054 : Unknown column 'madonna' in 'where clause'

Notice that madonna has not been crypted by the PASSWORD call either.

Andrew

-Original Message-
From: Daniel Barton [mailto:[EMAIL PROTECTED]]
Sent: Friday, 11 January 2002 2:40 PM
To: Necro
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Result Resource


Andrew:

Don't put quotes around your MySQL function call.

i.e.

PASSWORD($password)

not

'PASSWORD($password)'

p.s. Looking at this thread, it seems like most of the errors you're
encountering have
nothing to do with md5() or password(), but with syntax, like placement of
quotes, or
whether they are single quotes or double quotes. I would suggest
experimenting with
the syntax a bit, to check out what's kosher, and what's not? Check out the
PHP
manual's sections on 'Resource id's - I think you may find it to be very
important to
understanding how PHP interacts with databases. Resource ids, which are
returned by
quite a few function calls, are not classic variables - they need to be
manipulated or
interpreted before you use them.

Cheers,
db



Necro wrote:

 Ok,

 I have tried to go to PASSWORD after none of the suggestions worked out.

 The current statement is:
 $arg = select password, 1 as auth from acl where
username='$username' and
 password = 'PASSWORD($password)';

 But the error I get now is:
 select password, 1 as auth from acl where username='andrewd' and password
=
 'PASSWORD(madonna)'Resource id #2

 Any ideas?

 Andrew

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 11 January 2002 8:56 AM
 To: Necro; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MySQL Result Resource

 Addressed to: Necro [EMAIL PROTECTED]
   [EMAIL PROTECTED]

 ** Reply to note from Necro [EMAIL PROTECTED] Fri, 11 Jan 2002
 03:41:43 +1100
  select password, 1 as auth from acl where (username='andrewd' and
  password=(163e06103a371fd95b21b4a849bb4b91))1064 : You have an error in
 your
  SQL syntax near 'a371fd95b21b4a849bb4b91))' at line 1
 
  Does that help give any idea at all as to what the problem is?
 

 There are no quotes around  163e06103a371fd95b21b4a849bb4b91  The
 error occurs where it does because '163e06103' is a valid exponential
 notation value for a nubmer, but having an 'a' follow it is not valid.

 My solution would be:

 $Pass = md5( whatever ); #  I don't care if you hash just the password
  #  or the username and password as long as
  #  you do it the same way as you entered
  #  the passwords.

 mysql_query( SELECT password, 1 AS auth  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 But I question what you are doing returning password, so it might work
 as well as:

 mysql_query( SELECT count(*) as Authorized  .
  FROM acl  .
  WHERE username = '$username'  .
AND password = '$Pass'  );

 This returns 0 or 1 in a field named Authorized depending on if the
 password matches or not.

 You might also want to look at the MySQL PASSWORD() function and not
 mess with md5 at all.

 Rick

 Rick Widmer
 Internet Marketing Specialists
 http://www.developersdesk.com

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
--
Dan Barton
Terrestrial Program Biologist
Asst. Data Manager
Point Reyes Bird Observatory
http://www.prbo.org
[EMAIL PROTECTED]
[EMAIL PROTECTED]



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL

Re: [PHP-DB] MySQL Result Resource

2002-01-10 Thread Jason Wong

On Friday 11 January 2002 10:33, Necro wrote:
 Ok,


 I have tried to go to PASSWORD after none of the suggestions worked out.

 The current statement is:
   $arg = select password, 1 as auth from acl where username='$username' and
 password = 'PASSWORD($password)';

 But the error I get now is:
 select password, 1 as auth from acl where username='andrewd' and password =
 'PASSWORD(madonna)'Resource id #2

 Any ideas?

 Andrew

Both PASSWORD and MD5 expect a *string* as an argument so you need to enclose 
the argument in either single quotes or double quotes.

 $arg = SELECT password, 1 AS auth
   FROM acl
  WHERE username = '$username'
AND password = PASSWORD('$password');

Hopefully that should work ;-)


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Love is the process of my leading you gently back to yourself.
-- Saint Exupery
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Mysql result resource error

2001-12-20 Thread Jim Lucas

which one was giving you the problem? the first or second mysql try.  if it
was the second, try wrapping the $cattyname with single quotes  like this
Minor_Category = '$cattyname'.  if the $cattyname var has anything but
numbers, the statement won't work.

Jim
- Original Message -
From: Shannon Doyle [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 19, 2001 4:19 PM
Subject: [PHP-DB] Mysql result resource error


 Hi People,

 I am getting a Not a valid Mysql result resource error with the
 following code, can someone take a look at this for me and see if there
 is anything that stands out

 Thanks,

 Shannon

 ?
 $cattyname = ;
 $sql = select Minor_Category main where Page = 'wines' order by
 Minor_Category;
 $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
 $results2 = mysql_db_query($db,$sql,$dbh);
   for($j = 0; $j  mysql_num_rows($results2); $j++) {
   $array[$j] = mysql_fetch_array($results2);
 }
 mysql_close($dbh);
 for ($h = 0; $h  count($array); $h++)  {

 if ($array[$h][Minor_Category] != $cattyname) {
   $cattyname = $array[$h][Minor_Category];
   echo trtd colspan='4'a
 name='.$cattyname.'/ab.$cattyname./b/td/td/tr;


 $catname = ;
 $sql = select Category,Code,Description,Pack,Unit,Price from main where
 Page = 'wines'  Minor_Category = $cattyname order by Category;
 $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
 $results = mysql_db_query($db,$sql,$dbh);
   for($i = 0; $i  mysql_num_rows($results); $i++) {
   $array[$i] = mysql_fetch_array($results);
 }
 mysql_close($dbh);

 for ($i = 0; $i  count($array); $i++)  {

 if ($array[$i][Category] != $catname) {
   $catname = $array[$i][Category];
   echo trtd colspan='4'a
 name='.$catname.'/ab.$catname./b/tdtd
 align='center'pbCarton Size/b/p/tdtd
 align='center'pbUnit/b/p/tdtd
 align='right'pbPrice/b/p/tdtda href='#top'img
 src='images/arrow.gif' border='0'/a/td/tr;
 }

   echo trtd/tdtdpa
 href=javascript:order_now(quot;.$array[$i][Code].quot;)img
 src='images/order.gif' border='0'/a/tdtd/tdtd
 align='left'p.$array[$i][Description]./p/tdtd
 align='center'p.$array[$i][Pack]./p/tdtd
 align='center'p.$array[$i][Unit]./p/tdtd
 align='right'p$.$array[$i][Price]./p/td/tr\n;
 }
 }
 }
 ?


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Mysql result resource error

2001-12-20 Thread Shannon Doyle

Hi Jim,

Ahh yes of courseI have corrected this.

I am still getting the error on the first query...not sure why. And now
I am getting a whole bunch of empty lines being output to the screen.
Like there is supposed to be data in those lines, but nothing happening.
Plus I am getting repeats of the same data. Its like it is doing each
query three times or something.

Don't know why it is doing that.

- Shannon

 -Original Message-
 From: Jim Lucas [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, 21 December 2001 03:52 AM
 To: Shannon Doyle; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Mysql result resource error
 
 
 which one was giving you the problem? the first or second 
 mysql try.  if it
 was the second, try wrapping the $cattyname with single 
 quotes  like this
 Minor_Category = '$cattyname'.  if the $cattyname var has anything but
 numbers, the statement won't work.
 
 Jim
 - Original Message -
 From: Shannon Doyle [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 19, 2001 4:19 PM
 Subject: [PHP-DB] Mysql result resource error
 
 
  Hi People,
 
  I am getting a Not a valid Mysql result resource error with the
  following code, can someone take a look at this for me and 
 see if there
  is anything that stands out
 
  Thanks,
 
  Shannon
 
  ?
  $cattyname = ;
  $sql = select Minor_Category main where Page = 'wines' order by
  Minor_Category;
  $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
  $results2 = mysql_db_query($db,$sql,$dbh);
for($j = 0; $j  mysql_num_rows($results2); $j++) {
$array[$j] = mysql_fetch_array($results2);
  }
  mysql_close($dbh);
  for ($h = 0; $h  count($array); $h++)  {
 
  if ($array[$h][Minor_Category] != $cattyname) {
$cattyname = $array[$h][Minor_Category];
echo trtd colspan='4'a
  name='.$cattyname.'/ab.$cattyname./b/td/td/tr;
 
 
  $catname = ;
  $sql = select Category,Code,Description,Pack,Unit,Price 
 from main where
  Page = 'wines'  Minor_Category = $cattyname order by Category;
  $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
  $results = mysql_db_query($db,$sql,$dbh);
for($i = 0; $i  mysql_num_rows($results); $i++) {
$array[$i] = mysql_fetch_array($results);
  }
  mysql_close($dbh);
 
  for ($i = 0; $i  count($array); $i++)  {
 
  if ($array[$i][Category] != $catname) {
$catname = $array[$i][Category];
echo trtd colspan='4'a
  name='.$catname.'/ab.$catname./b/tdtd
  align='center'pbCarton Size/b/p/tdtd
  align='center'pbUnit/b/p/tdtd
  align='right'pbPrice/b/p/tdtda href='#top'img
  src='images/arrow.gif' border='0'/a/td/tr;
  }
 
echo trtd/tdtdpa
  href=javascript:order_now(quot;.$array[$i][Code].quot;)img
  src='images/order.gif' border='0'/a/tdtd/tdtd
  align='left'p.$array[$i][Description]./p/tdtd
  align='center'p.$array[$i][Pack]./p/tdtd
  align='center'p.$array[$i][Unit]./p/tdtd
  align='right'p$.$array[$i][Price]./p/td/tr\n;
  }
  }
  }
  ?
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]