Error during data INSERT in php

Posted by nectar on Stack Overflow See other posts from Stack Overflow or by nectar
Published on 2010-06-02T07:01:44Z Indexed on 2010/06/02 7:03 UTC
Read the original article Hit count: 158

Filed under:
|

here my code-

$sql = "INSERT INTO tblpin ('pinId', 'ownerId', 'usedby', 'status') VALUES ";

for($i=0; $i0) { $sql .= ", "; } $sql .= "('$pin[$i]', '$ownerid', 'Free', '1')"; } $sql .= ";";

echo $sql;

mysql_query($sql); if(mysql_affected_rows() > 0) { echo "done"; } else { echo "Fail"; }

output: ** INSERT INTO tblpin ('pinId', 'ownerId', 'usedby', 'status') VALUES ('13837927', 'admin', 'Free', '1'), ('59576082', 'admin', 'Free', '1'); Fail

why it is not inserting values when $sql query is right?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql-query