[PHP] Problem with implode() function

2002-07-16 Thread Balaji Ankem

Hi,
 I have an array of elements which are separated with the operator
comma(,).

==
$array = implode(,, $checkb);

echo $array.'\n';

$result = mysql_query(DELETE FROM temp WHERE inv_tag IN
($array)) or die('Error in query'.mysql_error());



PTX526_P_1,SIM_1

Error in query Unknown column 'PTX526_P_1' in 'where clause'.

Thanks and Regards
Balaji



**Disclaimer

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***



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


Re: [PHP] Problem with implode() function

2002-07-16 Thread Jason Wong

On Tuesday 16 July 2002 22:40, Balaji Ankem wrote:
 Hi,
  I have an array of elements which are separated with the operator
 comma(,).

 ==
   $array = implode(,, $checkb);

   echo $array.'\n';

   $result = mysql_query(DELETE FROM temp WHERE inv_tag IN
 ($array)) or die('Error in query'.mysql_error());
 


 PTX526_P_1,SIM_1

 Error in query Unknown column 'PTX526_P_1' in 'where clause'.

Well I can't see what this has to do with PHP let alone the implode() 
function.

The error quite clearly says unknown column ...

The proper use of IN requires that string values must be enclosed in either 
single-quotes or double-quotes. Thus you need to make $array look like:

  'PTX526_P_1','SIM_1'
or
  PTX526_P_1,SIM_1

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
It is the wisdom of crocodiles, that shed tears when they would devour.
-- Francis Bacon
*/


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




RE: [PHP] Problem with implode() function

2002-07-16 Thread Balaji Ankem

Hi Jason,
 How to make $array look like  'PTX526_P_1','SIM_1' or
PTX526_P_1,SIM_1.

Thanks and Regards
Balaji


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, July 16, 2002 8:22 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Problem with implode() function


On Tuesday 16 July 2002 22:40, Balaji Ankem wrote:
 Hi,
  I have an array of elements which are separated with the operator 
 comma(,).

 ==
   $array = implode(,, $checkb);

   echo $array.'\n';

   $result = mysql_query(DELETE FROM temp WHERE inv_tag IN
 ($array)) or die('Error in query'.mysql_error()); 
 


 PTX526_P_1,SIM_1

 Error in query Unknown column 'PTX526_P_1' in 'where clause'.

Well I can't see what this has to do with PHP let alone the implode() 
function.

The error quite clearly says unknown column ...

The proper use of IN requires that string values must be enclosed in
either 
single-quotes or double-quotes. Thus you need to make $array look like:

  'PTX526_P_1','SIM_1'
or
  PTX526_P_1,SIM_1

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
It is the wisdom of crocodiles, that shed tears when they would devour.
-- Francis Bacon
*/


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



**Disclaimer

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***



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


Re: [PHP] Problem with implode() function

2002-07-16 Thread 1LT John W. Holmes

  I have an array of elements which are separated with the operator
 comma(,).

 ==
 $array = implode(,, $checkb);

 echo $array.'\n';

 $result = mysql_query(DELETE FROM temp WHERE inv_tag IN
 ($array)) or die('Error in query'.mysql_error());
 


 PTX526_P_1,SIM_1

 Error in query Unknown column 'PTX526_P_1' in 'where clause'.


Use quotes around string..otherwise MySQL things your telling it a column
name.

$array = ' . implode(',',$checkb) . ';

---John Holmes...


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