close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Coupon option list

Thread began 10/13/2010 12:53 am by kenstites342105 | Last modified 11/03/2010 2:39 am by kenstites342105 | 651 views | 3 replies |

kenstites342105

Coupon option list

My Client wants to have a drop down list for Coupons that can be selectes in the shopping cart. I made a new recordset called PowerStoreCoupons and have added an option field in place of the text field. However, the list is only being populated with the first record.

index.php



I have tried this out on a blank page and it works ok, but is not working on cart.php page. Can anyone see what I have wrong here?

Thanks so much,
Ken

Recordset:
mysql_select_db($database_PowerStoreConnection, $PowerStoreConnection);
$query_PowerStoreCoupons = "SELECT ps3_coupons.CouponID, ps3_coupons.CouponCode, ps3_coupons.CouponIsLive FROM ps3_coupons WHERE ps3_coupons.CouponIsLive = 1 ORDER BY ps3_coupons.CouponCode";
$PowerStoreCoupons = mysql_query($query_PowerStoreCoupons, $PowerStoreConnection) or die(mysql_error());
$row_PowerStoreCoupons = mysql_fetch_assoc($PowerStoreCoupons);
$totalRows_PowerStoreCoupons = mysql_num_rows($PowerStoreCoupons);

<span style="float:left"><h2>Coupon Code:&nbsp;
<select name="CID" id="CID">
<?php
do {
?>
<option value="<?php echo $row_PowerStoreCoupons['CouponCode']?>"<?php if (!(strcmp($row_PowerStoreCoupons['CouponCode'], $row_PowerStoreCoupons['CouponCode']))) {echo "selected=\"selected\"";} ?>><?php echo $row_PowerStoreCoupons['CouponCode']?></option>
<?php
} while ($row_PowerStoreCoupons = mysql_fetch_assoc($PowerStoreCoupons));
$rows = mysql_num_rows($PowerStoreCoupons);
if($rows > 0) {
mysql_data_seek($PowerStoreCoupons, 0);
$row_PowerStoreCoupons = mysql_fetch_assoc($PowerStoreCoupons);
}
?>
</select>
</h2>
</span>

Attached Files
cart.zip
Sign in to reply to this post

Dani Chankhour

It looks like the free result is in the wrong place.

Please move this line of code:

mysql_free_result($PowerStoreCoupons);

to the bottom of the page.

Sign in to reply to this post

mick106153

Gentlemen

Could you please expound on this a bit more.
It sounds very much like I would like to do.
First kenstites did this work as you expected and Dani when you said to move that line to the bottom of the page did you mean that literally - to make it the last line on the page?
Pardon the rudimentary nature of my questions but it seems the more I learn - the less I know.

Mick

Sign in to reply to this post

kenstites342105

Coupon option list

Hi Mick.

Dreamweaver placed this line up toward the top of the page:

mysql_free_result($PowerStoreCoupons);


When I deleted that line from the top of the page and then the put this code as the very last thing after the </html> tag, my coupon option list showed all of the coupons.

<!-- InstanceEnd --></html>
<?php
if ($PowerStoreCoupons) {
mysql_free_result($PowerStoreCoupons);
}
?>

Ken

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...