jeffers Posted November 30, 2005 Share Posted November 30, 2005 Hello folks Thought i'll try and learn some php coding to accustomise my site so it's more to my liking, but tragically fallen down at the 2nd hurdle. In mysql the command line for the info i require is select manufacturers_id from products where products_id = 377; this returns the answer required which is 35 but how to i get this to work in oscommerce, i have the lines $manu_query = tep_db_query(...................); $account = tep_db_fetch_array($manu_query); echo $account; now it is the bits marked ........ that i have tried with all to no avail because in theory the part that says echo $account; should print on the screen 35 I know i am connecting to the database as a previous calculation within the page gives me the figure 377. Hope someone can help Jeff Link to comment Share on other sites More sharing options...
Chris Dunning Posted November 30, 2005 Share Posted November 30, 2005 Jeff - It would help quite a bit to show us your entire code, rather than just "......." - no telling what's going on with that. The function tep_db_fetch_array is a wrapper for the function mysql_fetch_array, which you can read about here: http://us2.php.net/mysql_fetch_array The function returns an array rather than just a single value. To see what's in the array, use: print_r($account); The short answer is, try this: echo $account['manufacturers_id']; I'm moving this thread to a more appropriate forum. Chris Dunning osCommerce, Contributions Moderator Team Please do not send me PM! I do not read or answer these often. Use the email button instead! I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly. Link to comment Share on other sites More sharing options...
jeffers Posted November 30, 2005 Author Share Posted November 30, 2005 The short answer is, try this: echo $account['manufacturers_id']; Thanks for a swift reply the above has done the trick and now i can progress. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.