driftwood Posted March 19, 2007 Posted March 19, 2007 Some of the items I sell are magazines. I have a database which is just one table with 10 fields, The fields have name like CoverPage, BackPage, ColourImages,BWImages etc. So as you can see this is a list of thing you might find in any magazine. What I want to do is pull this list into the description for each magazine. I have been working on this but I'm not expert. I can get it to do what I want in a plain PHP file like this; <?php $mag_query = tep_db_query("SELECT CoverPage,BackPage,FullPageImageColor,FullPageImageBW,Articles,TeamImage,Notes from " . magazines . " WHERE `Issu` = '0020'"); $result = tep_db_fetch_array($mag_query); ?> <font face="arial" color="black" size="1"> Cover Page <?php echo $result['CoverPage']?><P> <font face="arial" color="black" size="1"> Back Page <?php echo $result['BackPage']?><P> <font face="arial" color="black" size="1"> Full Page Colour Images <?php echo $result['FullPageImageColor']?><P> <font face="arial" color="black" size="1"> Full Page Black and White Images <?php echo $result['FullPageImageBW']?><P> <font face="arial" color="black" size="1"> Articles included <?php echo $result['Articles']?><P> <font face="arial" color="black" size="1"> Full Team Images <?php echo $result['TeamImage']?><P> <font face="arial" color="black" size="1"> Other Notes <?php echo $result['Notes']?><P> I know it's not pretty but I'm just clearing hurdles right now till I know I have a fully working method. My problem is when I add this to the description page of the product it doesn't work. I'm sure I'm missing something fundimental here so I would love someone to lend an hand if you could ? TIA ----------------------------------------------------------------------------- OSC user for years and no coder, so I've earned my stripes. Feel free to private message me.
bill110 Posted March 19, 2007 Posted March 19, 2007 You probably need to add this database as tables in the main database. Or in your configure.php files somehow refrence this database so you can make calls to it from you script. My Contributions Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly Password Protect Admin "No matter where you go....There you are" - Buccaroo Bonsai
driftwood Posted March 20, 2007 Author Posted March 20, 2007 You probably need to add this database as tables in the main database. Or in your configure.php files somehow refrence this database so you can make calls to it from you script. I've added it to the main database and tested it at the bottom of another page. It works fine till I add it as code in the product description. ----------------------------------------------------------------------------- OSC user for years and no coder, so I've earned my stripes. Feel free to private message me.
GemRock Posted March 20, 2007 Posted March 20, 2007 I've added it to the main database and tested it at the bottom of another page. It works fine till I add it as code in the product description. I dont think this is possible. PHP is a server side scripting language. PhP code hidden/embedded in description will be parsed to the client side as text and wont be excused by the client browser. What is possible is html tags in the description as html is 'client side' and will be understood by the browser. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience.
driftwood Posted March 20, 2007 Author Posted March 20, 2007 I dont think this is possible. PHP is a server side scripting language. PhP code hidden/embedded in description will be parsed to the client side as text and wont be excused by the client browser. What is possible is html tags in the description as html is 'client side' and will be understood by the browser. Ken Yes it seems this is correct, I'm looking at a java solution now but open to other ideas if anyone has one. I suppose I could edit the product_info template to add an IF statment - if catagory Magazine -> then add the code there. Not that I would have any idea what I'm doing :blink: Thanks. ----------------------------------------------------------------------------- OSC user for years and no coder, so I've earned my stripes. Feel free to private message me.
Jack_mcs Posted March 20, 2007 Posted March 20, 2007 I know it's not pretty but I'm just clearing hurdles right now till I know I have a fully working method. My problem is when I add this to the description page of the product it doesn't work. I'm sure I'm missing something fundimental here so I would love someone to lend an hand if you could ?Take a look at the embed link contribution. It won't do what you want but it will provide the outline of the code you need to accomplish this. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
driftwood Posted March 20, 2007 Author Posted March 20, 2007 Take a look at the embed link contribution. It won't do what you want but it will provide the outline of the code you need to accomplish this. Jack No, don't have a clue what I'm looking Jack sorry :blink: I think I can do it javascript but seems like a slegehammer to crack a nut when in thory all I need to do is display one record out of a table in the database. Perhaps I could also do it by converting the table to a Html and using "includes and bookmarks" but I was hoping to search on the issue number to make it easy adding 1000 of these. Anyway thanks for your help I'll press on with it. Dave. ----------------------------------------------------------------------------- OSC user for years and no coder, so I've earned my stripes. Feel free to private message me.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.