S.B S.B - 5 months ago 7
PHP Question

insert into with multiple rows not working

i can't make this insert into work. can someone tell me where i'm doing wrong?

$id_application = 1;
foreach ($array_account as $rows) {
$e_mail = $rows["EMAIL"];
$pwd = $rows["PWD"];
$salt = $rows["SALT"];

$values = "(" . $e_mail . ", " .$pwd . ", " .$salt . ", " . $id_application . ")";
$query = "INSERT INTO DBNAME..ACCOUNT (EMAIL, PWD, SALT, ID_APPLICATION) "
. " VALUES " . $values;
$result = sybase_query($query);
}


these are the errors that iget:

Column names are illegal. (severity 15, procedure N/A
The identifier that starts with '...' is too long. Maximum length is 30
The name '...' is illegal in this context. Only constants, constant expressions, or variables
allowed here


i'm able to insert a single row in sybase central like:

insert into DBNAME..ACCOUNT (EMAIL, PWD, SALT, ID_APPLICATION)
select EMAIL, PWD, SALT, 3 from ACCOUNT where ID = 10 go

Answer
Do this $values = "('" . $e_mail . "', '" .$pwd . "', '" .$salt .  "', '" . $id_application . "')"; 
Comments