answersLogoWhite

0

The same way you insert 1 row, just 10,000 times.

There are two choices, I'm going to assume you've already connected to mysql and you are prepared to run your query:

1. Transactional method:

$query = "INSERT INTO foo (column) VALUES (row1), (row2), (row3) ... (row10000);";

mysql_query($query);

This is ideal when it is imperative that all rows go into the database. Keep in mind that this method will tie up the database until the entire query is completed.

2. Separate queries

$query = "INSERT INTO foo (column) VALUES (row1); INSERT INTO foo (column) VALUES (row2); ... INSERT INTO foo (column) VALUES (row10000);";

mysql_query($query);

This method will allow other queries to run along side and will not necessarily tie up the database, if it's ok if some rows fail this method is probably ideal.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is an insert query in PHP and MySQL?

In a database table, the INSERT INTO statement is used to insert new rows. Let's create a SQL query with acceptable values using the INSERT INTO statement, and then run it by passing it to the PHP mysqli query() function to insert data into the table. To learn more about data science please visit- Learnbay.co


How can i Have php post to self with mysql?

Mysql is an Database where Data from HTML forms will be inserted to it by some scripts like ASP 3 (classic), ASP.NET, PHP, ColdFusion and... What you need is a form (By HTML), an Database and table in Mysql and PHP to insert data from your form to the table. mysql insert command is: INSERT INTO table_name_here (column1, column2, ..) VALUES (value_of_column_1, value_of_column_2, ...)


How to use strings with PHP and MySQL?

If you will see this example as below, this may help. <?php $string = mysql_real_escape_string($string); $sql = "insert into stringtable(mystring) values('$string')"; ?>


Which mysql product is suitable for php connection?

mysql client library


How do you retrieve data from one MySQL table and create another MySQL table with the same data in it using PHP?

Execute a SELECT INTO statement on the mysql database: INSERT INTO destination_table (id, first_name, last_name) SELECT id, first_name, last_name from source_table;


What has the author Janet Valade written?

Janet Valade has written: 'PHP & MySQL' 'PHP & MySQL web development all-in-one desk reference for dummies' -- subject(s): Computer Technology, Nonfiction, OverDrive, PHP (Computer programming language), SQL (Computer program language), Web site development 'PHP et MYSQL' 'PHP and MySQL for Dummies'


Where can someone find more information about the php mysql tutorial?

One can find more information about the php mysql tutorial on Tutorials Point, Tizag, and W3 Schools. More information about the php mysql tutorial can be found at Site Ground.


Who can design your website in PHP and MySQL?

Any of the millions of web developers using PHP and MySQL around the world. Either that or teach yourself!


Can you run PHP and MySQL on Linux?

Yes.


How do you develop software using PHP and MySQL?

how do u develop software using php and mysql?


How are PHP and MySQL compatible?

By sending messages to the MySQL server, you can communicate with the database. To submit SQL queries to the database, you use PHP functions. You don't need to know how to communicate with MySQL because PHP takes care of that. You only need to be familiar with SQL queries and PHP functions. To learn more about data science please visit- Learnbay.co


What are the advantages and disadvantages of PHP with mysql?

Ultimately PHP is a programming language and MySQL is a database language. Using PHP with MySQL is a nice combination with built-in support and the simplicity of it all. However, there aren't a lot of disadvantages of using PHP with a database, it just allows for better data organization and whatnot. There are definitely advantages and disadvantages to using a database other than MySQL (such as MongoDB or PostgreSQL).