Hi All,

I have this expression;
        $query  =       "INSERT INTO $table (%s) VALUES (%s)";
        $query  =       sprintf($query, implode(",", $fld), implode(",",
$val));
        $result =       mssql_query($query) or die($errmsg); 
I am trying to insert values from an array into the database.
I keep getting the error that I can't pass column names in this context.
I know it's because I'm not enclosing $val in quotes.  
I've tried a number of variations;
implode("\"","\"", $val)
implode("\',\'", $val)
implode(",", "\"".$val."\"") - This blows up nicely ;-)

Where am I going wrong on this?


alex hogan

 

*************************************************************************************
The contents of this e-mail and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom it is addressed. The 
views stated herein do not necessarily represent the view of the company. If you are 
not the intended recipient of this e-mail you may not copy, forward, disclose, or 
otherwise use it or any part of it in any form whatsoever. If you have received this 
e-mail in error please e-mail the sender. 
*************************************************************************************

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

Reply via email to