Jump to content

Code Slows Things Considerably Down


son
 Share

Recommended Posts

For each product stored via SESSIONS in cart application I would like to offer an option to make per drop-down that will be passed on when someone clicks onto checkout. The code is:

		$pa_id = $row['product_id'];		$q2 = "SELECT * FROM ageing WHERE ageing_id IN (SELECT age_id FROM productAge WHERE product_id = $pa_id) ORDER BY ageing_id";		$r2 = mysqli_query($dbc, $q2);			if (mysqli_num_rows($r2) > 0)			{			?><label for="ageing">Ageing:</label><select name="ageing<?php echo $pa_id ;?>" id="ageing<?php echo $pa_id ;?>"><?php				while (list($ageing_id, $ageing_name) = mysqli_fetch_array($r2, MYSQLI_NUM)) 				{				echo "<option value=\"$ageing_id\"";					if((isset($_POST['ageing'])) && ($_POST['ageing'] == $ageing_id))					{ 					echo ' selected="selected" '; 					} 					echo ">" . $ageing_name . "</option>";				}			echo "</select><br  />";		}

It slowed things down really badly. Taking this bit out makes the page upload quickly again. Not sure what is causing the delay... Also $_POST['ageing'] should be something like $_POST['ageing' . $pa_id] (so that each product has unique drop down name/id. Not sure how you would do this... Any hints appreciated...Son

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...