[PHP] Query Returning Error

2004-10-13 Thread Harlequin
Morning all.

this is such a basic question I'm embarrassed to ask but the query worked 
fine a few minutes ago and now returns an error:

I get an error:

Parse error: parse error, unexpected '=' in sample.php on line 2

[CODE]
// Authenticate User:
   Query01 = SELECT * FROM Users
   WHERE UserID='$_POST[TXT_UserID]'
   AND UserPassword='$_POST[TXT_UserPassword]';
   $Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
[/CODE]

WTF...?

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
- 

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



Re: [PHP] Query Returning Error

2004-10-13 Thread Jason Wong
On Wednesday 13 October 2004 15:32, Harlequin wrote:

 this is such a basic question I'm embarrassed to ask but the query worked
 fine a few minutes ago and now returns an error:

Change everything back to what it was a few minutes ago?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Murphy was a grunt
-- Murphy's Military Laws n56
*/

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



Re: [PHP] Query Returning Error

2004-10-13 Thread Harlequin
Doh...!

thanks mate.

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
Jason Wong [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Wednesday 13 October 2004 15:32, Harlequin wrote:

 this is such a basic question I'm embarrassed to ask but the query worked
 fine a few minutes ago and now returns an error:

 Change everything back to what it was a few minutes ago?

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Murphy was a grunt
 -- Murphy's Military Laws n56
 */ 

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



Re: [PHP] Query Returning Error

2004-10-13 Thread Jason Davidson
should Query01 have a $ in front of it, i assume its a var

Jason

Harlequin [EMAIL PROTECTED] wrote: 
 
 Morning all.
 
 this is such a basic question I'm embarrassed to ask but the query worked 
 fine a few minutes ago and now returns an error:
 
 I get an error:
 
 Parse error: parse error, unexpected '=' in sample.php on line 2
 
 [CODE]
 // Authenticate User:
Query01 = SELECT * FROM Users
WHERE UserID='$_POST[TXT_UserID]'
AND UserPassword='$_POST[TXT_UserPassword]';
$Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
 [/CODE]
 
 WTF...?
 
 -- 
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 - 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] Query Returning Error

2004-10-13 Thread Jordi Canals
On Wed, 13 Oct 2004 08:32:17 +0100, Harlequin
[EMAIL PROTECTED] wrote:
 Morning all.
 
 this is such a basic question I'm embarrassed to ask but the query worked
 fine a few minutes ago and now returns an error:
 
 I get an error:
 
 Parse error: parse error, unexpected '=' in sample.php on line 2
 
 [CODE]
 // Authenticate User:
Query01 = SELECT * FROM Users

$Query01

WHERE UserID='$_POST[TXT_UserID]'
AND UserPassword='$_POST[TXT_UserPassword]';
$Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
 [/CODE]


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



RE: [PHP] Query Returning Error

2004-10-13 Thread Graham Cossey
Besides adding $ to Query01, I have had little luck in the past when  using
$_POST or $_GET directly in an evaluated string. If you are still having
problems, try something like:

?php
$user = $_POST['TXT_UserID'];
$pwd = $_POST['TXT_UserPassword'];

// Authenticate User:
   $Query01 = SELECT * FROM Users
   WHERE UserID='$user' AND
 UserPassword='$pwd';
   $Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
?

HTH

Graham

 -Original Message-
 From: Harlequin [mailto:[EMAIL PROTECTED]
 Sent: 13 October 2004 08:32
 To: [EMAIL PROTECTED]
 Subject: [PHP] Query Returning Error


 Morning all.

 this is such a basic question I'm embarrassed to ask but the query worked
 fine a few minutes ago and now returns an error:

 I get an error:

 Parse error: parse error, unexpected '=' in sample.php on line 2

 [CODE]
 // Authenticate User:
Query01 = SELECT * FROM Users
WHERE UserID='$_POST[TXT_UserID]'
AND UserPassword='$_POST[TXT_UserPassword]';
$Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
 [/CODE]

 WTF...?

 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

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



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



Re: [PHP] Query Returning Error

2004-10-13 Thread Chris Dowell
You can get around this problem more easily by putting your variables 
inside curly brackets when they appear inside strings.

See here: 
http://uk.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

Or as an example:
?php
$Query01 = SELECT * FROM Users
WHERE UserID = '{$_POST['TXT_UserID']}'
AND UserPassword = '{$_POST['TXT_UserPassword']}';
$Result01 = mysql_query($Query01) or die (Error 01:  . mysql_error());
?
Note also that you didn't quote the index you were using inside the 
$_POST array. This is wrong - it will work in raw PHP because it will 
be interpreted as an undefined constant, and thus replaced with the 
string, however the behaviour inside a quoted string is even less 
correct, and will almost certainly not do what you expect.

Hope this helps
Cheers
Chris
Graham Cossey wrote:
Besides adding $ to Query01, I have had little luck in the past when  using
$_POST or $_GET directly in an evaluated string. If you are still having
problems, try something like:
?php
$user = $_POST['TXT_UserID'];
$pwd = $_POST['TXT_UserPassword'];
// Authenticate User:
   $Query01 = SELECT * FROM Users
   WHERE UserID='$user' AND
 UserPassword='$pwd';
   $Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
?
HTH
Graham

-Original Message-
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 13 October 2004 08:32
To: [EMAIL PROTECTED]
Subject: [PHP] Query Returning Error
Morning all.
this is such a basic question I'm embarrassed to ask but the query worked
fine a few minutes ago and now returns an error:
I get an error:
Parse error: parse error, unexpected '=' in sample.php on line 2
[CODE]
// Authenticate User:
  Query01 = SELECT * FROM Users
  WHERE UserID='$_POST[TXT_UserID]'
  AND UserPassword='$_POST[TXT_UserPassword]';
  $Result01 = mysql_query($Query01) or die(Error 01:  . mysql_error());
[/CODE]
WTF...?
--
-
Michael Mason
Arras People
www.arraspeople.co.uk
-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


RE: [PHP] Query Returning Error

2004-10-13 Thread Graham Cossey
Thanks Chris, that'll help keep my code a bit more 'compact'.
(Sorry Harlequin, kinda hijacked your post here)

Graham

 -Original Message-
 From: Chris Dowell [mailto:[EMAIL PROTECTED]
 Sent: 13 October 2004 11:57
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Query Returning Error


 You can get around this problem more easily by putting your variables
 inside curly brackets when they appear inside strings.

 See here:
 http://uk.php.net/manual/en/language.types.string.php#language.typ
 es.string.parsing.complex

 Or as an example:

 ?php

 $Query01 = SELECT * FROM Users
 WHERE UserID = '{$_POST['TXT_UserID']}'
 AND UserPassword = '{$_POST['TXT_UserPassword']}';

 $Result01 = mysql_query($Query01) or die (Error 01:  . mysql_error());

 ?

 Note also that you didn't quote the index you were using inside the
 $_POST array. This is wrong - it will work in raw PHP because it will
 be interpreted as an undefined constant, and thus replaced with the
 string, however the behaviour inside a quoted string is even less
 correct, and will almost certainly not do what you expect.

 Hope this helps

 Cheers

 Chris


 Graham Cossey wrote:
  Besides adding $ to Query01, I have had little luck in the past
 when  using
  $_POST or $_GET directly in an evaluated string. If you are still having
  problems, try something like:
 
  ?php
  $user = $_POST['TXT_UserID'];
  $pwd = $_POST['TXT_UserPassword'];
 
  // Authenticate User:
 $Query01 = SELECT * FROM Users
 WHERE UserID='$user' AND
   UserPassword='$pwd';
 $Result01 = mysql_query($Query01) or die(Error 01:  .
 mysql_error());
  ?
 
  HTH
 
  Graham
 
 
 -Original Message-
 From: Harlequin [mailto:[EMAIL PROTECTED]
 Sent: 13 October 2004 08:32
 To: [EMAIL PROTECTED]
 Subject: [PHP] Query Returning Error
 
 
 Morning all.
 
 this is such a basic question I'm embarrassed to ask but the
 query worked
 fine a few minutes ago and now returns an error:
 
 I get an error:
 
 Parse error: parse error, unexpected '=' in sample.php on line 2
 
 [CODE]
 // Authenticate User:
Query01 = SELECT * FROM Users
WHERE UserID='$_POST[TXT_UserID]'
AND UserPassword='$_POST[TXT_UserPassword]';
$Result01 = mysql_query($Query01) or die(Error 01:  .
 mysql_error());
 [/CODE]
 
 WTF...?
 
 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 

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



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



RE: [PHP] Query Returning Error

2004-10-13 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Chris Dowell [mailto:[EMAIL PROTECTED] 
 Sent: 13 October 2004 11:57
 
 Note also that you didn't quote the index you were using inside the 
 $_POST array. This is wrong - it will work in raw PHP 
 because it will 
 be interpreted as an undefined constant, and thus replaced with the 
 string, however the behaviour inside a quoted string is even less 
 correct, and will almost certainly not do what you expect.

Wrong -- the behaviour inside a quoted string is *more* correct, as it's a
documented valid way to do it (whereas it's a documented way *not* to do it
outside a string!).

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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