son Posted October 17, 2009 Share Posted October 17, 2009 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 More sharing options...
justsomeguy Posted October 17, 2009 Share Posted October 17, 2009 Try to run that query in phpMyAdmin, if it takes more than a second or so return results then you probably need to add some indexes onto the tables. Link to comment Share on other sites More sharing options...
son Posted October 19, 2009 Author Share Posted October 19, 2009 Try to run that query in phpMyAdmin, if it takes more than a second or so return results then you probably need to add some indexes onto the tables.Run query, took 0.0273 sec. So this should be fine...Son Link to comment Share on other sites More sharing options...
son Posted October 19, 2009 Author Share Posted October 19, 2009 Run query, took 0.0273 sec. So this should be fine...SonI have now changed the selection along with colour choice to item page. Makes more sense to have it there anyway and eliminates my problem... Thanks for your help!Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.