chrometweaks.org

What do you think about the iPage.com commercials?

Click Here To View All Answers...


First off, What do you think about the iPage.com commercials? Thanks in advance for any comment. 2nd question I got is.. I am creating a magazine page within Oscommerce, to encourage sales in my site..

I would like to be able to pull in information from the database, such as the price individually per product. This page would be static apart from these live fields so that if I change the price in the admin and it changes it on this page also..

I was trying to start with something like:-.

<?php.

$result = mysql_query( "SELECT products_price FROM products WHERE products_id = 42");.

?>.

<p><?php echo"$result" ?>.

I have already called in application_top for native osc commands, but I don't know how to display just the price from products_id number 42 for example..

Any help would be greatly appreciated..

Nev..

Comments (28)

Good question... I dunno what is the answer. I'll do some research in Google and get back to you if I find an useful answer. You should email the people at iPage as they probably could help you..

Comment #1

You could store all of them in an array and use the id as the key..

[CODE].

<?.

$result=mysql_query("select products_price, products_id from products");.

While ($fetcher=mysql_fetch_array($result)){.

$prices[$fetcher['products_id']]=$fetcher['products_price'];.

}.

Then.

Echo $prices[put_id_here];?>.

Note: this only gets the price stored in the products table. It doesn't get specials prices, prices for attributes, etc...

Comment #2

Excellent, that works a treat..

But in my haste I think I have gone the wrong route because the price we are pulling is the raw database price that doesn't have the tax and currency applied etc etc, we need the same prices as would show within a normal product page..

So I need to use OSC's native functions to pull the price, any ideas?.

Thanks for your advice so far, I have learnt a lot about basic php..

Nev..

Comment #3

Look at the code to pull the price on the product_info.php page. Copy the sql query and take out what you don't need...

Comment #4

I am creating a magazine page within Oscommerce, to encourage sales in my site..

I would like to be able to pull in information from the database, such as the price individually per product. This page would be static apart from these live fields so that if I change the price in the admin and it changes it on this page also..

I was trying to start with something like:-.

<?php.

$result = mysql_query( "SELECT products_price FROM products WHERE products_id = 42");.

?>.

<p><?php echo"$result" ?>.

I have already called in application_top for native osc commands, but I don't know how to display just the price from products_id number 42 for example..

Any help would be greatly appreciated..

Nev..

Comment #5

Thats Great thanks..

Is there a way that I can pull in all the prices for example, and pull the right one and the right time..

E.g.

<?php $result=mysql_fetch_array(mysql_query("SELECT products_price FROM products)); ?>.

<p> Product One's Price is <?php echo $result[products_price WHERE products_id = 1]"; ?></p>.

<p><p> Product Two's Price is <?php echo $result[products_price WHERE products_id = 2]"; ?></p>.

Or something that actually works unlike my example..

Thanks in advance.

Nev..

Comment #6


This question was taken from a support group/message board and re-posted here so others can learn from it.