Jump to content

makenoiz

Members
  • Posts

    20
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

makenoiz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks... greatly appreciate your responses. Really any help is great
  2. This code is from a program that autopopulates a zencart store. This part reads one of the config tables. When I run this query directly against my database I get about 50 pairs of data (there are 50 records). Im confused why there is no array defined to hold these results. It just does not make sense to me. How can all those 50 pairs of data be held in $stats when $stats is not defined as an array? Thank you....
  3. I am having a hard time undestanding this code snippit. Can someone help translate it for me. I guess I dont understand how -> works. and how executing a mysql statement can be a variable Thank you $stats = $db->Execute('select stats_key as stsKey, stats_value as stsValue from myCurrentStats'); while (!$stats->EOF) { if (!defined($stats->fields['stsKey'])) { define($stats->fields['stsKey'], $stats->fields['stsValue']); } $stats->MoveNext(); }
  4. I'm an intermediate php coder however I have a new situation. I need to do some remapping of categories from CSV files we get from our supplier for our php ecommerce store. We use mySQL back end. We are importing data from a Supplier and need to remap the category names for our online store. There are 16,000 entries in the CSV file. This is what I need to do. 1) grab the CSV from the suppliers (from their ftp location) 2) remap the suppliers category names on the acquired CSV to our stores category names. I can either create a new table with the category name relation ships (probably best?) or read my mapping CSV ? 3) save the new CSV to our server where our auto import program can grab it. Eventually, Id like a cron to run the new script but for now Ill do it manually during testing period. Thats it! but... as simple as it sounds, I dont know how to start this. Below is an example of what needs to be dont just to clarify. PHP Code: Our Category(A) | Their Category(B) | Product © | Product Cat (D) | New Product Cat (E) 1. dog/leash/long | Pet/walking | Item A | Pet/sleeping|bed ** This is what we need to get** 2. dog/leash|long | Pet/walking | Item B | Pet/walking 3. dog/leash|long | Pet/sleeping bed | Item C | Pet/walking Here is my pseudo code: for each value in Column D (run the test on each value in Column D) for each value in B as i ( check each value in Column B) if B(i) = D1 then E1 =A(i) end for end for The new path in this example for Item A would be A3 and would be written to E1. I have 15,000 entries to do. Thank you for any help
  5. I am using x-cart 4.4.3. The default contact us form allows the viewer to choose from several departments to send the mail form to however, the x-cart developers have decided that it is a "feature" that all emails from the form, regardless of which department is chosen on the form, go to One email address that is defined in the settings. Its really ridiculous however I cannot seem to modify it. If anyone has time, Id love some assistance on making the work "right". Here is one part of the code that Im sure is integral in making the modification: include/help.php if ($REQUEST_METHOD == 'POST' && $action == 'contactus') { // Send mail to support $body = $_POST['body'] = stripslashes($_POST['body']); $contact = $_POST; $contact['titleid'] = func_detect_title($contact['title']); x_session_register('antibot_contactus_err'); $antibot_contactus_err = (!empty($active_modules['Image_Verification']) && func_validate_image("on_contact_us", $antibot_input_str)); // For email as login option, replace username with email if ($default_fields['username']['avail'] == 'Y' && $config['email_as_login'] == 'Y') { $contact['username'] = $contact['email']; } //Fill values for func_check_required_fields/emails templates if (is_array($additional_fields)) { $contact['additional_fields'] = array(); foreach ($additional_fields as $k => $v) $additional_fields[$k]['value'] = $contact['additional_fields'][$k]['value'] = stripslashes($contact['additional_values'][$k]); } // Check required fields $fillerror = !func_check_required_fields($contact, $current_area, 'contact_us'); // Check email if ( ( $default_fields['email']['required'] == 'Y' || !empty($contact['email']) ) && !func_check_email($contact['email']) ) { $fillerror = true; } // Check subject and body if (!$fillerror) { $fillerror = (empty($subject) || empty($body)); } if (!$fillerror && !$antibot_contactus_err) { $contact['b_statename'] = func_get_state(stripslashes($contact['b_state']), stripslashes($contact['b_country'])); $contact['b_countryname'] = func_get_country(stripslashes($contact['b_country'])); if ($config['General']['use_counties'] == 'Y') $contact['b_countyname'] = func_get_county($contact['b_county']); $contact = func_stripslashes($contact); if (!empty($active_modules['SnS_connector']) && $current_area == 'C') func_generate_sns_action('FillContactForm'); $mail_smarty->assign('contact', $contact); $mail_smarty->assign('default_fields', $default_fields); $mail_smarty->assign('is_areas', $is_areas); $mail_smarty->assign('additional_fields', $additional_fields); if ( !func_send_mail( $config['Company']['support_department'], 'mail/help_contactus_subj.tpl', 'mail/help_contactus.tpl', $contact['email'], false ) ) { $top_message = array( 'type' => 'E', 'content' => func_get_langvar_by_name("lbl_send_mail_error") ); $userinfo = $_POST; $userinfo['login'] = $userinfo['uname']; $store_contactus = $userinfo; } else { $store_contactus = false; func_header_location("help.php?section=contactus&mode=sent"); } } else { $userinfo = func_stripslashes($_POST); $userinfo['login'] = $userinfo['uname']; $userinfo['fillerror'] = $fillerror; $userinfo['antibot_contactus_err'] = $antibot_contactus_err; $store_contactus = $userinfo; $top_message = array( 'type' => 'E', 'content' => func_get_langvar_by_name($fillerror ? 'txt_registration_error' : 'msg_err_antibot') ); } func_header_location("help.php?section=contactus&mode=update&err=1"); } My site is not live yet or I would post the URL, however you can look at the x-cart demo: http://xcart-demo.qtmsoft.com/demo/help.php?section=contactus&mode=update Here is the thread confirming that all departs go to the same address: http://forum.x-cart.com/showthread.php?t=9520&page=2 Any help would be greatly appreciated
  6. Can someone tell me what some of the purposes of this would be? global $PHP_SELF; its defined right after a function like this function myFunction(module =' '){ global $PHP_SELF; .... } Thanks
  7. Thank you.. I will try this today and let you know right away. I really appreciate your suggestion.
  8. Hi there - I have two tables and Im comparing one field from each db in order to create a bunch of drop down that have "selected" values. here are the tables: Table A +--------------+--------------------+ + id description +--------------+--------------------+ + 1 Hot +--------------+--------------------+ + 2 Cold +--------------+--------------------+ + 3 Wet +--------------+--------------------+ + 4 Dry +--------------+--------------------+ Table B +--------------+----------------+-------------------+----------------+-------------------+ + Date svcIssueCatID1 svcIssueCatNotes1 svcIssueCatID2 svcIssueCatNotes2 +--------------+----------------+-------------------+----------------+-------------------+ + 2009-02-01 1 It was too hot 4 It was too dry +--------------+----------------+-------------------+----------------+-------------------+ I know there is a more elegant way to code this using loops but Im not sure where to start. Everytime I start I end up with a mess. I need one loop to get all the categoried from table A then another loop to create each of the 3 sets of drp down/text fields Can anyone point me in the right direction? Thanks <?PHP $query = "SELECT `svcIssueCatID1`, `svcIssueCatNotes1`, `svcIssueCatID2`, `svcIssueCatNotes2`,`svcIssueCatID3`, `svcIssueCatNotes3`,FROM `tableB` WHERE `date`=\"".$selDate."\" "; $result = mysql_query($query); $row = mysql_fetch_array($result); $tableBID_1 = $row['svcIssueCatID1']; $tableBID_2 = $row['svcIssueCatID2']; $tableBID_3 = $row['svcIssueCatID3']; $tableBID_4 = $row['svcIssueCatID4']; $tableBNotes_1 =$row[svcIssueCatNotes1]; $tableBNotes_2 =$row[svcIssueCatNotes2]; $tableBNotes_3 =$row[svcIssueCatNotes3]; $tableBNotes_4=$row[svcIssueCatNotes4]; $options=""; $query_tableA = "SELECT * from tableA"; $result_tableA = mysql_query($query_tableA); while ($row_tableA = mysql_fetch_array($result_tableA)) { $tableAID = $row_tableA['id']; $tableADesc = $row_tableA['description']; if ($tableAID == $tableBID_1 ){ $isSelected = "selected"; } $options.="<OPTION VALUE=\"".$tableAID."\" ".$isSelected.">".$tableADesc."</option>"; $isSelected = ""; } ?> <SELECT name="CatID_1"><?=$options?> </SELECT> <textarea name="Notes_1" cols="50" rows="6"><?=$tableBNotes_1; ?></textarea> <? $options=""; $query_tableA = "SELECT * from tableA"; $result_tableA = mysql_query($query_tableA); while ($row_tableA = mysql_fetch_array($result_tableA)) { $tableAID = $row_tableA['id']; $tableADesc = $row_tableA['description']; if ($tableAID == $tableBID_2 ){ $isSelected = "selected"; } $options.="<OPTION VALUE=\"".$tableAID."\" ".$isSelected.">".$tableADesc."</option>"; $isSelected = ""; } ?> <SELECT name="CatID_2"><?=$options?> </SELECT> <textarea name="Notes_2" cols="50" rows="6"><?=$tableBNotes_2; ?></textarea> <? $options=""; $query_tableA = "SELECT * from tableA"; $result_tableA = mysql_query($query_tableA); while ($row_tableA = mysql_fetch_array($result_tableA)) { $tableAID = $row_tableA['id']; $tableADesc = $row_tableA['description']; if ($tableAID == $tableBID_3 ){ $isSelected = "selected"; } $options.="<OPTION VALUE=\"".$tableAID."\" ".$isSelected.">".$tableADesc."</option>"; $isSelected = ""; } ?> <SELECT name="CatID_3"><?=$options?> </SELECT> <textarea name="Notes_3" cols="50" rows="6"><?=$tableBNotes_3; ?></textarea> ......... then later I update table B
  9. HI thanks for both of your replies: Errant_shadow, I believe <?=$options?> is an echo. if you dont have the PHP in there, I believe its considered an echo. I think I read that somewhere. printf, they are actually two different querys, one has a WHERE in it so that Im pulling specific info based on the other table, the other is SELECT *, just so I can get all the categories for the options list in the form. Im not sure how I could select * catgeories, then pull only those records I need out of that array based on the Id. If you have a suggestion, Id love to hear it Thanks for your replies
  10. I found it! if ($row_svcIssueCats['si_cats_id'] = $row_svcIssues['service_issue_id '] ){ $isSelected = "selected"; should have been if ($row_svcIssueCats['si_cats_id'] == $row_svcIssues['service_issue_id'] ){ $isSelected = "selected"; Add another = and remove extra space in $row_svcIssues['service_issue_id '] Thanks to those who jumped on this....
  11. Removed it... and still no selected option on the drop downs. Thanks though.. Heres the new code with both of your changes: ......... <?PHP $selDate = ($_GET['selDate'] != '')? $_GET['selDate']:$_POST['selDate']; // get the service issues based on date $query_svcIssues = "SELECT * from service_issue_categories , service_issue_log WHERE service_issue_log.si_date='".$selDate."' AND service_issue_log.service_issue_id=service_issue_categories.si_cats_id"; $result_svcIssues = mysql_query($query_svcIssues); if(mysql_num_rows($result_svcIssues) > 0) { // there are issue in db while($row_svcIssues = mysql_fetch_array($result_svcIssues)){ ?> <div class="field"><span class="label">Service Comments:<br /> </span><br> <span class="box"><input type="text" size="30" name="svcIssue_<?=$row_svcIssues['service_issue_log_id']; ?>" value="<?=$row['heading'];?>" /> <?php // form the service issue drop down boxes $options=""; // get the service issue cateories $query_svcIssueCats = "SELECT * from service_issue_categories"; $result_svcIssueCats = mysql_query($query_svcIssueCats); while ($row_svcIssueCats = mysql_fetch_array($result_svcIssueCats)) { // while there are still categories $tblsvcissueid=$row_svcIssueCats['si_cats_id']; $tblsvcdescription=$row_svcIssueCats['si_cats_description']; //if the id of the category matches the id in our event list place as the selected in option list if ($row_svcIssueCats['si_cats_id'] = $row_svcIssue['service_issue_id'] ){ $isSelected = "selected"; } // close if $options.="<OPTION VALUE=\"".$tblsvcissueid."\" ".$isSelected.">".$tblsvcdescription."</option>"; $isSelected = ""; } // close while ?> <SELECT NAME='si_category'> <OPTION VALUE=0>Choose <?=$options?> </SELECT> <span class="box"><textarea name="svcIssue_<?=$row_svcIssues['service_issue_log_id']; ?>" cols="50" rows="6"><?=$row_svcIssues['service_issue_log_description']; ?></textarea></span> </div> <?PHP } // end while........
  12. Thanks Ill make that change and see if it make a difference... thank you for the speedy reply... ........................ -- made the change but still no selected value on the drop downs for each service issue description. Thank you though
  13. I have an html form in php page that is populated from mysql db.. 2 tables service_issue_categories +-----------+--------+------------+ | si_cats_id | si_cats_description | +-----------+--------+------------+ | 1 | Complaint | | 2 | Compliment | | 3 | Poor Appearance | | 4 | Great Appearance | +-----------+--------+------------+ service_issue_log +--------------------+----------------+-----------------------+----- | service_issue_log_id| service_issue_id | service_issue_log_desc |date +--------------------+----------------+-----------------------+----- | 1 | 2 | Very nice place | 2009-02-05 | 2 | 1 | Heater too hot | 2009-02-05 | 3 |4 | Was dressed great | 2009-02-05 +--------------------+----------------+-----------------------+----- I have success fully populated textarea boxes with service_issue_log.service_issue_log_desc but I need drop downs next to them with a list of all possible choices for service_issue_categories. si_cats_description but with the correct category as "selected" in the options drop down for that particular description. I can get the drop downs populated but I cant get the correct Categoery as the initial "selected" value in the drop down. Seems like this should be easy considering that I have everything else working just fine but I have spent 2 days on it and I know it just the way I have the logic of my PHP statements. Can any of you take a look and tell me if you can spot the issue right off. I would greatly appreciate it. ......... <?PHP $selDate = ($_GET['selDate'] != '')? $_GET['selDate']:$_POST['selDate']; // get the service issues based on date $query_svcIssues = "SELECT * from service_issue_categories , service_issue_log WHERE service_issue_log.si_date='".$selDate."' AND service_issue_log.service_issue_id=service_issue_categories.si_cats_id"; $result_svcIssues = mysql_query($query_svcIssues); if(mysql_num_rows($result_svcIssues) > 0) { // there are issue in db while($row_svcIssues = mysql_fetch_array($result_svcIssues)){ ?> <div class="field"><span class="label">Service Comments:<br /> </span><br> <span class="box"><input type="text" size="30" name="svcIssue_<?=$row_svcIssues['service_issue_log_id']; ?>" value="<?=$row['heading'];?>" /> <?php // form the service issue drop down boxes $options=""; // get the service issue cateories $query_svcIssueCats = "SELECT * from service_issue_categories"; $result_svcIssueCats = mysql_query($query_svcIssueCats); $row_svcIssueCats = mysql_fetch_array($result_svcIssueCats); while ($row_svcIssueCats = mysql_fetch_array($result_svcIssueCats)) { // while there are still categories $tblsvcissueid=$row_svcIssueCats['si_cats_id']; $tblsvcdescription=$row_svcIssueCats['si_cats_description']; //if the id of the category matches the id in our event list place as the selected in option list if ($row_svcIssueCats['si_cats_id'] = $row_svcIssue['service_issue_id'] ){ $isSelected = "selected"; } // close if $options.="<OPTION VALUE=\"".$tblsvcissueid."\" ".$isSelected.">".$tblsvcdescription; $isSelected = ""; } // close while ?> <SELECT NAME='si_category'> <OPTION VALUE=0>Choose <?=$options?> </SELECT> <span class="box"><textarea name="svcIssue_<?=$row_svcIssues['service_issue_log_id']; ?>" cols="50" rows="6"><?=$row_svcIssues['service_issue_log_description']; ?></textarea></span> </div> <?PHP } // end while........ Thanks in advance
  14. Im having this problem too and Im not happy about it. Its screwing up my php scripts. Does someone know how to turn that crap off in DW CS3?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.