optomize this script to run a lot faster

Cerrado Publicado Aug 19, 2014 Pagado a la entrega
Cerrado Pagado a la entrega

okay so there is a 100 million rows in my database what i need is this script to run faster right now it queries the database for each file it creates .. it takes about two and half hours is there any options to query the database only once?

file is attached.

I need this done right now max pay is $30

code is below

<form method="get">

<input type="text" name="where" value="">

<input type="submit" value="Submit">

</form>

<?php

$check4empty = true;

if(!isset($_GET['where']))

exit;

$where = $_GET['where'];

$host = "localhost"; // host name

$user = "xx"; // database user name

$pass = "xx"; // database password

$database = "xxxx"; // database name

$connect = @mysql_connect($host,$user,$pass)or die (@mysql_error());

mysql_select_db($database,$connect) or die (mysql_error());

// changes by pradeep

$results = mysql_query("SELECT count(*) as total FROM `$where`");

print mysql_error();

$values = mysql_fetch_assoc($results);

$num_rows = $values['total'];

$ii = 0;

$filenameCounter = 1;

while ($ii < $num_rows)

{

$ourFileName = "map/$where".$filenameCounter.".xml";

$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");

fwrite($ourFileHandle, '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="[url removed, login to view]">');

$query = mysql_query("SELECT * FROM `$where` ORDER BY domain ASC LIMIT ".$ii.",50000");

while ($row = mysql_fetch_assoc($query)) {

$id = $row['domain'];

fwrite($ourFileHandle, '<url>

<loc> [url removed, login to view]'.$id.'.'.$where.'</loc>

<changefreq>monthly</changefreq>

<priority>1.0</priority>

</url>

');

}

fwrite( $ourFileHandle ,'</urlset>') ;

fclose($ourFileHandle);

$ii = $ii + 50000;

$filenameCounter++;

}

// end changes

echo "$where";

MySQL PHP Arquitectura de software Gestión de páginas web

Nº del proyecto: #6344462

Sobre el proyecto

5 propuestas Proyecto remoto Activo Sep 25, 2014

5 freelancers están ofertando un promedio de $27 por este trabajo

sriraj1233

Hello, I am ready to fix this problem. I have the solution to fix this. I have four and half years of professional experience in designing, developing scripts and integrating scripts in php and mysql. I have gone t Más

$25 USD en 1 día
(97 comentarios)
5.7
brainwithstorm

Sure you can query it only once. Open cursor to data and directly write into files (OR directy MySQL utility to export the data). Also i would like to check structure of table if possible to see how it's declared. I ca Más

$30 USD en 1 día
(46 comentarios)
5.1
parhtrai2

Hi, I am an experienced web developer with the experience of more than 5 years in the same field. I am highly capable of providing you an ideal solution. I will increase the speed of your script and If you want I c Más

$30 USD en 2 días
(2 comentarios)
2.0
jocic

Hello, I can optimize your script and deliver it to you within a day. If you are interested please send me a message. Best regards!

$25 USD en 1 día
(7 comentarios)
1.7