Where the class is defined as follows: class PDOMultiLineInserter inserts), the following errors occurred:". I have created a class that performs multi-line that is used as follows: $pdo->beginTransaction() Here we using 3 file for insert data in MySQL: database.php :For connecting data base insert. I have the image in my uploads folder, retrieved from the database, but everything else, including the image in the database is recorded as 0. For insert data in MySQL first we have to create a table in data base. If you have lots of columns to put together, and one or more are very long, you could also build an inner loop to do the same thing and use implode() to assign the values clause to the outer array. I have a code to insert posts, author, image, date and time, category and Post description, into the database. The advantage of this approach is that you don't copy and re-copy the SQL statement you've so far assembled with each concatenation instead, PHP does this once in the implode() statement. Mysql_query('INSERT INTO table (text, category) VALUES '.implode(',', $sql)) I have the image in my uploads folder, retrieved from the database, but everything else, including the image in the database is recorded as 0. The fastest and most memory efficient way to build a large string, such as for inserting hundreds of rows at one, is to take advantage of the implode() function and array assignment. 20 hours ago &0183 &32 I have a code to insert posts, author, image, date and time, category and Post description, into the database. Primarily, this means you want to avoid concatenation. Basically, when working with large strings, you want to minimize unnecessary copying. That said, it sounds like you might be running into string-handling problems in PHP, which is really an algorithm problem, not a language one. Assembling one INSERT statement with multiple rows is much faster in MySQL than one INSERT statement per row.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |