INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Php mysql queries run slow on wampserver 2.5 version

Php mysql queries run slow on wampserver 2.5 version

Php mysql queries run slow on wampserver 2.5 version

(OP)
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?

RE: Php mysql queries run slow on wampserver 2.5 version

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 http://www.uniformserver.com/ to see if this issue is limited to WAMPserver 2.5 and not the updated versions of PHP/MySQL.

RE: Php mysql queries run slow on wampserver 2.5 version

(OP)
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:

CODE --> 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:


CODE --> 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?

RE: Php mysql queries run slow on wampserver 2.5 version

Quote:

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

RE: Php mysql queries run slow on wampserver 2.5 version

(OP)
I meant nested query

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close