custodian Posted March 22, 2006 Posted March 22, 2006 Ok.. I'm playing around with some code trying to fully graps everything. My structure appears correct but my results are not. When I run the following I get "Resource id #44" - And I have no idea where it is getting that from. Here the basic format of my efforts. <?php require('includes/application_top.php'); include('includes/configure.php'); if (!tep_session_is_registered('customers_id')) { // Get the info desired... $result = tep_db_query("select 'customers_gender' from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '"); // Print those results... echo $result; } ?> I'm fairly confused at this point, I've been googling all day. I got it working at one point - sort off. It would return the value, but only from the first entry in the DB. My Contributions Henry Smith
boxtel Posted March 22, 2006 Posted March 22, 2006 Ok.. I'm playing around with some code trying to fully graps everything. My structure appears correct but my results are not. When I run the following I get "Resource id #44" - And I have no idea where it is getting that from. Here the basic format of my efforts. <?php require('includes/application_top.php'); include('includes/configure.php'); if (!tep_session_is_registered('customers_id')) { // Get the info desired... $result = tep_db_query("select 'customers_gender' from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '"); // Print those results... echo $result; } ?> I'm fairly confused at this point, I've been googling all day. I got it working at one point - sort off. It would return the value, but only from the first entry in the DB. $result will be a query resource at that point so you need to use : first put the row in an array: $result_array = tep_db_fetch_array($result); before you can use : echo $result_array['customers_gender']; Treasurer MFC
custodian Posted March 22, 2006 Author Posted March 22, 2006 $result will be a query resource at that point so you need to use : first put the row in an array: $result_array = tep_db_fetch_array($result); before you can use : echo $result_array['customers_gender']; :wub: :wub: :wub: :wub: :wub: :wub: :wub: :wub: :wub: Oh Amanda how I love thee! I have actually tried that ealier but didn't change the echo formatting. So my results were still mangled. It works perfectly now. I've been working on a contrib and this is the only thing I absolutely could not get to work, although my only php trainign has come from looking through OSC and the forum.. my php/mysql books haven't arrived yet, but they should be here any day - I can't wait! Since you are obviously quite proficient with PHP, could you recommend any sites that are possible thorough in their explainations, but more advanced then "Hello World!" examples? My Contributions Henry Smith
boxtel Posted March 22, 2006 Posted March 22, 2006 :wub: :wub: :wub: :wub: :wub: :wub: :wub: :wub: :wub: Oh Amanda how I love thee! I have actually tried that ealier but didn't change the echo formatting. So my results were still mangled. It works perfectly now. I've been working on a contrib and this is the only thing I absolutely could not get to work, although my only php trainign has come from looking through OSC and the forum.. my php/mysql books haven't arrived yet, but they should be here any day - I can't wait! Since you are obviously quite proficient with PHP, could you recommend any sites that are possible thorough in their explainations, but more advanced then "Hello World!" examples? well, I am doing this php now for 2 year but still am a novice, maybe I should get a book as well. what I know is mostly by reading here and by not simply installing a contribution but actually reading it to understand how it works (or was supposed to work in many cases). I normally check functions and constructs here : www.php.net (also has some posts from users who have their own beliefs as to how to use php) and look for novel ideas in here www.phpclasses.org both non-commercial sites so modrs bite your trigger-happy-delete finger. but there are many more php resources out there. Treasurer MFC
custodian Posted March 26, 2006 Author Posted March 26, 2006 Amanda, Thank you for your help with the tep_session. You and JanZ helped me to finsih my contrib. the help I recieved from both of you (this and another thread) is greatly appreciated! My Contributions Henry Smith
Recommended Posts
Archived
This topic is now archived and is closed to further replies.