Re: [PHP] query works in mysql, but not from php

2001-11-19 Thread Brian Clark

Hi Olav,

@ 5:58:14 PM on 11/19/2001, Olav Drageset wrote:

OD Hi

OD $sql = SELECT user FROM persons WHERE user = '$firstName' and domain = 
'$domainName' ; ;

Remove the semi-colon:

$sql = SELECT user FROM persons WHERE user = '$firstName' and domain = '$domainName';

--
 -Brian Clark | PGP is spoken here: 0xE4D0C7C8
  Please, DO NOT carbon copy me on list replies.


-- 
PHP General 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] query works in mysql, but not from php

2001-11-19 Thread Christian Dechery

remove the ; at the end...

mysql_query() doesn't need it... since it only executes on atomic command, 
the ; is useless..

that's what's causing the error...

At 22:58 19/11/01 +, Olav Drageset wrote:
Hi

$sql = SELECT user FROM persons WHERE user = '$firstName' and domain = 
'$domainName' ; ;
$result = mysql_query($sql,$connection ) or die(mysql_error());

Calling above lines from php returns: You have an error in SQL syntax 
near ';'  at line 1

Issuing the command

SELECT user FROM persons WHERE user = 'fred' AND domain = 'company.net' ;

in mysql give a proper result.

Can anyone explain what might be causing the error???
regards Olav


--
PHP General 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]


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General 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] query works in mysql, but not from php

2001-11-19 Thread Steve Cayford

You don't need to put in the final semi-colon when running a query from 
php. Take that out and you should be fine.

-Steve

On Monday, November 19, 2001, at 04:58  PM, Olav Drageset wrote:

 Hi

 $sql = SELECT user FROM persons WHERE user = '$firstName' and domain = 
 '$domainName' ; ;
 $result = mysql_query($sql,$connection ) or die(mysql_error());

 Calling above lines from php returns: You have an error in SQL 
 syntax near ';'  at line 1

 Issuing the command

 SELECT user FROM persons WHERE user = 'fred' AND domain = 
 'company.net' ;

 in mysql give a proper result.

 Can anyone explain what might be causing the error???
 regards Olav


 --
 PHP General 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 General 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] query works in mysql, but not from php

2001-11-19 Thread Martín Marqués

On Lun 19 Nov 2001 19:58, Olav Drageset wrote:
 Hi

 $sql = SELECT user FROM persons WHERE user = '$firstName' and domain =
 '$domainName' ; ; $result = mysql_query($sql,$connection ) or
 die(mysql_error());

 Calling above lines from php returns: You have an error in SQL syntax
 near ';'  at line 1

Through away the semicolon (;), that only tells the MySQL interpreter that 
the quiery should be executed.
In PHP, each call to the query function executes it.

Saludos... :-)

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-

-- 
PHP General 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]