SQL Insertion Help - Changing Attributes
Posted: Tue Dec 02, 2008 8:17 am
I am trying to use a function to insert a value pulled from one SQL table and inserted into another. The original and destination field attribute is money, but when using the insert function, the value is being converted to varchar and causing the insertion to fail.
By no means am I expert at this and appreciate any assistance.
Thanks.
function addUser($array)
{
global $my_con;
$sql="Insert into (";
$keys=implode(",",array_keys($array));
$values=implode("','",array_values($array));
$sql="Insert into mp_marketer_accounts($keys)values('$values')";
print($sql);
$result=odbc_exec($my_con, $sql);
$sql="select top 1 SEQ_NBR_PK from mp_marketer_accounts order by SEQ_NBR_PK desc";
$result=odbc_exec($my_con, $sql);
By no means am I expert at this and appreciate any assistance.
Thanks.
function addUser($array)
{
global $my_con;
$sql="Insert into (";
$keys=implode(",",array_keys($array));
$values=implode("','",array_values($array));
$sql="Insert into mp_marketer_accounts($keys)values('$values')";
print($sql);
$result=odbc_exec($my_con, $sql);
$sql="select top 1 SEQ_NBR_PK from mp_marketer_accounts order by SEQ_NBR_PK desc";
$result=odbc_exec($my_con, $sql);