Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Php mysql queries run slow on wampserver 2.5 version

Status
Not open for further replies.

lexer

Programmer
Jun 13, 2006
432
VE
Hi, I dont know If this is right forum for this thread, I'm using wampserver 2.0b (It has apache 2.2.8, Mysql 5.0.51a and php 5.2.5) installed on windows 7 (64bits), I'm doing php-mysql nestle queries and run fast, I uninstall 2.0b version and installed wampserver 2.5 (32bit I couldn't install 64 bits), Now When I do the same queries on wampserver 2.5, these queries run slower than in version 2.0b. Please, Do the Php and Mysql that comes with wampserver 2.5 version requieres more CPU processing or Do I have to set up something?
 
I'm sorry but that question is nearly impossible to answer as we cannot see what type of system and configuration you have.

It would also help to know what a "nestle" query is.

However if you would like to provide some more detailed information we will do our best to help.

MySQL and PHP are well documented on their respective sites, and you may find more support on forum.wampserver.com

You might explore other development WAMP offerings like to see if this issue is limited to WAMPserver 2.5 and not the updated versions of PHP/MySQL.
 
Thanks for answer,

Basically, I've got 3 queries, Query 4 is inside Query 2, Query 2 and 4 are inside Query 1

Query 1 Gets Deparment
Query 2 Gets Extension (for every department)
Query 4 Gets calls calls duration and cost for every extension with the same deparment

This is just the code for queries Wampserver 2.5 run very slow:

PHP:
$con = mysqli_connect("localhost","root","password","calls");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

$query1 = "SELECT departament ".
"FROM departaments ".
"ORDER BY departaments.departament ";
$result1 = mysqli_query($con,$query1) or die(mysql_error());


while($row1 = mysqli_fetch_assoc($result1))
{
//Do query2
$query2 = "SELECT * ".
"FROM estructura ";
"ORDER BY estructura.Ext ";
$result2 = mysqli_query($con,$query2) or die(mysql_error());
//Loop Query2
while($row2 = mysqli_fetch_assoc($result2))
{

//Do Query4
$query4 = "SELECT iva.iva, registro.Ext, estructura.responsable, tarifas.numero, registro.duracion, tarifas.destino, tarifas.costo AS CostoX, estructura.departament, registro.numero, registro.Nombrenumero, registro.tipodestino, registro.TipoLlam, registro.duracionpbx, registro.fecha, registro.hora, ((registro.duracion*tarifas.costo)+ cargobase) AS Total ".
"FROM registro , estructura , tarifas, iva ".
"WHERE registro.Ext = estructura.Ext AND registro.IdLlam = tarifas.IdLlam AND registro.TipoLlam = '$Direccion' AND registro.tipodestino LIKE '$tipodestinof%' AND fecha BETWEEN '$calendar8M' AND '$calendar9M' AND hora BETWEEN '$horaini' AND '$horafin' AND registro.numero LIKE '$numerob%' AND registro.duracionpbx >= '$duracionbf' ORDER BY estructura.Ext, fecha, hora ";
$result4 = mysqli_query($con,$query4) or die(mysql_error());
// Print out the contents of each row into a table

while($row4 = mysqli_fetch_assoc($result4))
{
//Si estructura.Ext = registro.Ext
if ($row1['departament'] == $row2['departament'])// AND $row2['tipodestino '] == $row3['tipodestino'])
{
if ($row2['Ext'] == $row4['Ext'])
{


echo $row4['Ext'];
echo $row4['duracionpbx'];
echo $row4['Total'];


} //Close If Si estructura.Ext = registro.Ext
} //Close If Si departament = departament
} //Close Query4


}//Close Query2
}//Close Query1

This is just the code for queries Wampserver 2.0b run faster:


PHP:
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("calls", $con);

//Do query1
$query1 = "SELECT departament ".
"FROM departaments ".
"ORDER BY departaments.departament ";
$result1 = mysql_query($query1) or die(mysql_error());


while($row1 = mysql_fetch_array($result1))
{
//Do Query2
$query2 = "SELECT * ".
"FROM estructura ";
"ORDER BY estructura.Ext ";
$result2 = mysql_query($query2) or die(mysql_error());
//Loop Query2
while($row2 = mysql_fetch_array($result2))
{

//Do Query4
$query4 = "SELECT iva.iva, registro.Ext, estructura.responsable, tarifas.numero, registro.duracion, tarifas.destino, tarifas.costo, estructura.departament, registro.numero, registro.Nombrenumero, registro.tipodestino, registro.TipoLlam, registro.duracionpbx, registro.fecha, registro.hora, ((registro.duracion*tarifas.costo)+ cargobase) AS Total ".
"FROM registro , estructura , tarifas, iva ".
"WHERE registro.Ext = estructura.Ext AND registro.IdLlam = tarifas.IdLlam AND registro.TipoLlam = '$Direccion' AND registro.tipodestino LIKE '$tipodestinof%' AND fecha BETWEEN '$calendar8M' AND '$calendar9M' AND hora BETWEEN '$horaini' AND '$horafin' AND registro.numero LIKE '$numerob%' AND registro.duracionpbx >= '$duracionbf' ORDER BY estructura.Ext, fecha, hora ";
$result4 = mysql_query($query4) or die(mysql_error());
// Print out the contents of each row into a table

while($row4 = mysql_fetch_array($result4))
{
//Si estructura.Ext = registro.Ext
if ($row1['departament'] == $row2['departament'])// AND $row2['tipodestino '] == $row3['tipodestino'])
{
if ($row2['Ext'] == $row4['Ext'])
{


echo $row4['Ext'];
echo $row4['duracionpbx'];
echo $row4['Total'];

} //Close If Si estructura.Ext = registro.Ext
} //Close If Si departament = departament
} //Close Query4

any ideas?
 
It would also help to know what a "nestle" query is.

Isn't that what you would use to check the coffee rota??

[morning]

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top