TheJoey Posted August 30, 2009 Share Posted August 30, 2009 I want to replace this fetch with fixed values Like Book $16 dollars. its for a shopping cart <?php $output[] = '<ul>'; while ($row = $result->fetch()) { $output[] = '<li>"'.$row['title'].'" by '.$row['author'].': £'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>'; } $output[] = '</ul>'; echo join('',$output); ?> Link to comment https://forums.phpfreaks.com/topic/172464-fixing-values/ Share on other sites More sharing options...
MasterACE14 Posted August 30, 2009 Share Posted August 30, 2009 do you have the fixed values somewhere? an array? database? Link to comment https://forums.phpfreaks.com/topic/172464-fixing-values/#findComment-909245 Share on other sites More sharing options...
TheJoey Posted August 30, 2009 Author Share Posted August 30, 2009 i have them stored in a array such as. $product = array('Men\'s Roller Blades'=> array( Price => 69.95, Shipping => 0.10 //shipping as a % of price ), 'Women\'s Roller Blades'=> array( Price => 63.95, Shipping => 0.10 //shipping as a % of price ), 'Helmet'=> array( Price => 34.99, Shipping => 0.05 //shipping as a % of price ), 'Knee Pads'=> array( Price => 22.99, Shipping => 0.08 //shipping as a % of price ), 'Knee and Elbow Pads'=> array( Price => 29.99, Shipping => 0.08 //shipping as a % of price )); Link to comment https://forums.phpfreaks.com/topic/172464-fixing-values/#findComment-909253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.