Ökii
04-29-2003, 01:16 PM
txt file upload, parsing that to get some values and inserting into database - simple enough.
to avoid looping and therefore multiple queries, I wanted to build a string and just put that into the mysql_query call ---
for( --- loop -- )
{
$query_string .= "INSERT INTO `a` VALUES('$b','$c'); ";
}
$addem = mysql_query($query_string);
which manages to insert the first one and then returns an error for the second.
If I echo the string and put it into a phpmyadmin sql query box it works fine, updates however many rows are read from the file.
Any idea what is wrong with the string building for a php+mysql query? Is it ok to seperate inserts with ; ?
to avoid looping and therefore multiple queries, I wanted to build a string and just put that into the mysql_query call ---
for( --- loop -- )
{
$query_string .= "INSERT INTO `a` VALUES('$b','$c'); ";
}
$addem = mysql_query($query_string);
which manages to insert the first one and then returns an error for the second.
If I echo the string and put it into a phpmyadmin sql query box it works fine, updates however many rows are read from the file.
Any idea what is wrong with the string building for a php+mysql query? Is it ok to seperate inserts with ; ?