i want to insert dummy data for testing my database.so i want to execute a single insert statement 1000 times.
is there any function to do so
or is there any script todo.
if so plz help me

i want to insert dummy data for testing my database.so i want to execute a single insert statement 1000 times.
is there any function to do so
or is there any script todo.
if so plz help me

With PHP you can create a loop

<?php
//connect to database first

$sql = 'INSERT INTO ...'; //change this to your query
for ($x=0;$x<1000;$x++) { 
mysql_query($sql);
}

?>

Hope that helps :)

i want to insert dummy data for testing my database.so i want to execute a single insert statement 1000 times.
is there any function to do so
or is there any script todo.
if so plz help me

Let's do it more realistic! :-)

My suggestion is: Create a "sample.txt" file put 1000 data separated by TAB with 3 columns inside.

or create 3 columns in MICROSOFT EXCEL FILE and save as TAB DELIMITTED.

e.g.
AA0001 TAB MR. LONELY TAB MALE
.
.
AA10000 TAB MR. LONELY TAB MALE

<form enctype="multipart/form-data" action="testing.php" method="POST">
    <blockquote>
      <table>
	        <input type="hidden" name="MAX_FILE_SIZE" value="500000" />

      <tr><td><span class="bold"> 1. Select file to load:</span></td>
          <td><input name="userfile" type="file" />

      </td></tr>
      <tr>
        <td class="bold"> 2. Put inside the database.:</td>    
          <td><input type="submit" value="Check this File" />
      </td></tr>
	  </table>
    </blockquote>
</form>


//ANOTHER FILE
//TESTING.PHP 
<?php
//Here's your submitted file temporary uploaded automatically
//on your php web server.
$thefile = $_FILES['userfile']['tmp_name'];

//OPEN BY YOUR SERVER
$fd = fopen ($thefile, "r");
while (!feof ($fd))
{
   $buffer = fgets($fd, 4096);
   $lines[] = $buffer;
}
fclose ($fd); 


foreach ($lines as $ln => $lv) {
$JText = explode("\t", $lv);

$myField1 = strlen($JText[0]); 
$myField2 = strlen($JText[1]); 
$myField3 = strlen($JText[2]); 

[PUT YOUR DATABASE INSERT CODE HERE]

}

echo "finished";

hope it will helps you friend.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.