Page 1 of 1

DB Error: ERROR: syntax error at or near "Array

Posted: Thu Aug 02, 2007 3:50 pm
by smilesmita
Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi there:

i am getting this error :
DB Error: ERROR: syntax error at or near "Array" On query: INSERT INTO am_ups_xml ( Array ) VALUES ( );

I am trying to insert the array values Key=>value kind of array ...this is the snippet of the code of insert:

Code: Select all

$insert_fields[] = $fields;
$insert_values[] = $value;

            }
    
   $query ="INSERT INTO am_ups_xml ( ".join(",", $insert_fields)." ) VALUES ( ".join(",",$insert_values). " );";
$r = $db->Query($query);

Please help!


Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Aug 02, 2007 3:56 pm
by John Cartwright

Code: Select all

$insert_fields[] = $fields;
$insert_values[] = $value;
Are $fields and $value arrays themselves? It sounds like you want to do

Code: Select all

$insert_fields = $fields;
$insert_values = $value;
instead. What does

Code: Select all

echo '<pre>'; print_r($insert_fields); print_r($insert_values);
yield?