Jump to content

Recommended Posts

1. I login to phpfreaks.net

 

2. Go to ajax help where I posted a topix requesting help. (YES, I've got a reply!) :D

 

Then I read what you just posted.  "You could find out why it loads slowly." 

 

Corbin, nothing personal but please don't reply to anymore of my posts.

 

 

I'm just simply asking if anybody else has had a similar problem. 

 

 

 

 

"Is there anything I can do about [it loading very slowly]?"

 

 

"You could find out why it loads slowly."

 

 

I was being dead serious.

 

 

How are we supposed to help you make it load not slowly if we don't know why it loads slowly?

Sorry Just_Johnny, but corbin is correct -

Can you give us more info..

for example..

is it due to a long complex sql query..

maybe its looking at a remote server..

is the output very large!

does it only run slow when using prototype.js..

i'll stop their but the list can get quite long..

 

you really need to give more info..

 

corbin's post was very direct without much detail (just like your first post)!

 

<?php 


$query = "SELECT DISTINCT(make) FROM lookup_table WHERE type IN ('Tuner_GT_Sp') ORDER BY make";
$result = MYSQL_QUERY($query);
$count = MYSQL_NUM_ROWS($result);
echo MYSQL_ERROR();

$makeArray = array("Choose Make");
for ($x=0; $x<$count; $x++){
           
$make = MYSQL_RESULT($result, $x, "make");
   	array_push($makeArray, $make);
}
mysql_close($dbConnection);
?>

<html>
<title>Spoiler Chooser</title>
<head>		
	<script type="text/javascript" src="prototype.js"></script>


	<script>

		function sendRequest() {
			new Ajax.Request("test2.php", 
				{ 
				method: 'post', 
				parameters: 'make='+ $F('make') + 'year='+ $F('year'),
				onComplete: showResponse 
				});
			}

		function showResponse(req){
			$('show').innerHTML= req.responseText;
		}
	</script>
</head>

<body>


	<form id="name" onsubmit="return false;">			
		<select name="make" id="make">
		<? for($x=0;$x<count($makeArray);$x++){
		 	 echo "<option value=\"".$makeArray[$x]."\">".$makeArray[$x]."</option>";
			 }
		?>			
		</select> 			
		<br/><br/>		
 <select name="year" id="year">			
	 <option value='Year'>Year</option>
             <option value='1980'>1980</option>
             <option value='1981'>1981</option>
             <option value='1982'>1982</option>
             <option value='1983'>1983</option>
             <option value='1984'>1984</option>
             <option value='1985'>1985</option>
 	 <option value='1986'>1986</option>
	 <option value='1987'>1987</option>
	 <option value='1988'>1988</option>
	 <option value='1989'>1989</option>
	 <option value='1990'>1990</option>
	 <option value='1991'>1991</option>
	 <option value='1992'>1992</option>
	 <option value='1993'>1993</option>
	 <option value='1994'>1994</option>
	 <option value='1995'>1995</option>
	 <option value='1996'>1996</option>
	 <option value='1997'>1997</option>
	 <option value='1998'>1998</option>
	 <option value='1999'>1999</option>
	 <option value='2000'>2000</option>
	 <option value='2001'>2001</option>
	 <option value='2002'>2002</option>
	 <option value='2003'>2003</option>
	 <option value='2004'>2004</option>
	 <option value='2005'>2005</option>
	 <option value='2006'>2006</option>
	 <option value='2007'>2007</option>
	 <option value='2008'>2008</option>
	 <option value='2009'>2009</option>
 </select>								

  <input type="submit" value="Search" onClick="sendRequest()">				
</form>		


	<div id="show"></div>

	<br/><br/>

</body>

</html>

 

 

Sorry corbin I didn't mean to take your reply the wrong way.  This is my code, it takes about 20 secs to display the select dropdown forms. 

 

I'm off to bed.. so not going to be much help but just 1 thing.. how long does that query take ?

as it make a question of just speeding that up..

 

(of course you could also reduce your script by 1 loop) but i don't think it will make a major impact

 

also is it this page or test2.php thats causing the problems (as i see results are loading from their)

<?php

$yearMake = $_POST['make'];
$yearMakeArray = explode("year=",$yearMake);

$make = $yearMakeArray[0];
$year = $yearMakeArray[1];


$query = "SELECT DISTINCT model,year FROM lookup_table WHERE type IN ('Tuner_GT_Sp') AND make='".$make."'";
$result = MYSQL_QUERY($query);
$count = MYSQL_NUM_ROWS($result);
echo MYSQL_ERROR();


$model_array = array();

for ($x=0; $x<$count; $x++){
  
  $model = MYSQL_RESULT($result, $x, "model");
  $year_string = MYSQL_RESULT($result, $x, "year");

    if (format_year($year_string, $year)){

	      array_push($model_array, $model); 
    }
}


  $model_array_unique = array_unique($model_array);
  $count = count($model_array_unique);


if($count == "0"){
echo "no matches";
}else{
  
	echo '<div style="position:absolute; right:115px; top:100px; width:200px; height:100px; background-color:#FB0303;">';
    echo "<font size=2><u>CHOOSE MODEL<br/><br/></u></font>";  
    for ($x=0; $x<$count; $x++){
       

	  echo $model_array_unique[$x]."<br>";

    }
  echo '</div>';
}


?>

 

Here is test2.php.  I think I'm going to stop using prototype guys, it's causing me to not know what I'm doing.  When I don't know what I'm doing I run here and post stupid questions.  :D

 

 

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.