Yes Rolf is correct
I think this is actually a perl Q... because I assume that is perl you are
using
so you should declare the array as:
@array = qw(bla bla bla bla lba);
Secondly using the array in the select will not give the desired results
because it will print out something like
select bla bla bla bla bla lba from ...

notice the lack of "," (commas) between the names... not a good solution I
am afraid.

regards
Barry

-----Original Message-----
From: Rolf Hopkins [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2001 04:42
To: David Jacobowitz; [EMAIL PROTECTED]
Subject: Re: Having trouble to use array in SELECT statement.


A suggestion.  I don't know what language you're using but try printing
$quary to the screen before it is passed to mysql.  If @inc_re is an array,
as you say, then in a lot of other languages, you're next line would be an
illegal statement.  Even the first statement looks incorrect but I don't
know.  Shouldn't the strings be quoted?  Why do you want to create an array
in the first place?  Isn't it easier with just a single string?  As far as I
see it, your SQL statement is how I would see it and of course it would
result in an error.  Check the manual for the language you're using for
correct syntax.

----- Original Message -----
From: "David Jacobowitz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 27, 2001 9:41
Subject: Having trouble to use array in SELECT statement.


> Hello,
>
> I have constructed an array using my table field names and trying to pass
> that array in the select statement.
>
> @inc_re = ( Hotels, Asian_Real_Estate, Smart_Buildings, Real_Estate,
> Senior_Living_Homes );
>
> $quary = "SELECT @inc_re FROM incu_real_estate LIMIT 1";
>
> But I am getting following error.
>
> ..]$./test.pl
> In string, @inc_sf now must be written as \@inc_sf at ./test.pl line 15,
> near "SELECT
> @inc_sf"
>
> I have added a \ infront of the array but the quary doesn't return any
> thing.
>
> Any suggestions?
>
> Thanks for any help.
>
> David.
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to