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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smilesmita
Forum Commoner
Posts: 30
Joined: Thu May 24, 2007 1:52 pm

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

Post 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]
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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?
Post Reply