Jump to content

Recommended Posts

I got a strange question...

 

I have wamp installed on my PC and have some troubles with the SPEED of executing a script.

Not that it is slow, not at all. Only the tests  I've done tells me that the speed of the script that is executed can give a wrong result.

Is it mysql database that can't handle the speed with wamp on a personal PC ? Thus NOT on a server.

 

I have a script that delete some rows, this works well -> InsertDelUpdateDB($mysqli, $sql, $parameters);

than I have to update the data in a certain row, a certain field... 

When I do a test with echo $var...  it gives me the right data. So no fault there.

 

when the script has to update that certain field it doesn't do the job well ! The data is not updated with the right data !!! But it IS updated with a part of the data !  Once again the script has no errors and SHOULD update the field with the right data.

 

So, in short, all the data needed has no errors, it's only  the update that makes mistakes when it has to execute 2 queries one after the after (without closing the DB connection), One time it works fine, than it don't...

 

When I do a test and use ONLY the update script with the data needed put in variabales, it works fine !

 

My question is : can there be a problem with the speed that mysql, wamp has to endure ?

 

Link to comment
https://forums.phpfreaks.com/topic/264813-speed-wamp-and-mysql/
Share on other sites

It's likely you have an error in your logic that is causing the update problem. Most likely you have a header() redirect that doesn't have an exit; statement after it, so when the remainder of your code on the page runs while the browser is performing the redirect, you get unexpected results.

 

It would take having all your code that reproduces the problem (less any database credentials) and a specific example of what data you are submitting, what data was in the database at the start and what incorrect data is left in the database after the code runs.

I understand what you're saying. There's no header before the update script involved ! Only at the end of the update and it has the exit;  as well.

The joke is that when I put die(); after the update, everything works well !

Can there be a problem with the speed and variables that's needed between the two queries ?

 

I have already looked at the codes before posting this and it's not the codes, nor the script , this I  am 100% sure.

That's why I am thinking in an other directon than the codes. But, am I using too much variables ?

 

codes between the 2 queries :

$arrayLordervalue  = explode(",", $orderlink); 
$diff                         = array_diff($arrayLordervalue,$arraydel);
$orderlinknewvalue = orderlink($diff);
$orderlinknewvalue = mysql_real_escape_string($orderlinknewvalue);
$linksubid                = mysql_real_escape_string($linksubid);


just for info : 
function ordervalue is for reading vars from an array :
// read vars uit array 
function orderlink($somevalue){
if(!empty($somevalue)){
	$i = 1;
	$values ="";
	$value2 ="";
	foreach($somevalue as $value) {
		if($i == 1){ $values[$i] = $value;}
		else { $values[$i] = ",". $value;  }
		$value2= $value2.$values[$i];
		$i++;
	}
	return $value2;
}
}

 

 

 

Sorry to be blunt, but the information you are posting is useless. You didn't even identify which variable is having the problem and what data is being submitted and what portion of it is being cut off.

 

We are not standing right next to you. We don't know what your code is, what your data is, what you entered, or what result you saw. Since adding a die statement changed the symptom, there is something in the code ON YOUR PAGE that is causing the problem.

 

You are asking someone else to help find the problem, but you aren't, can't, or won't post all the code that reproduces the problem and what data values are being used (this could be due to the actual data and a html problem in your form.)

I don't want to be disrespectful but it wasnt meant to check the codes but more about the theory.

However I solved it by redoing some variables even when there was no error and by using sleep(0.5).

I encountered the same problem with ASP in the past and when I was searching the net yesterday, I see that I am not the only

one !

Thanks anyway !

 

 

Hey, I can't change the status to RESOLVED !

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.