Jump to content

keithschm

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by keithschm

  1. Thank you all very much. I struggled with the left join but once I got it working if fixed my issue. Thank you all very much for your help
  2. function getCache($address) { if(!isset($this->dsn)) return false; $_ret = array(); // PEAR DB require_once('DB.php'); $_db =& DB::connect($this->dsn); if (PEAR::isError($_db)) { die($_db->getMessage()); } $_res =& $_db->query("SELECT lon,lat FROM {$this->_db_cache_table} where address = ?", $address); if (PEAR::isError($_res)) { die($_res->getMessage()); } if($_row = $_res->fetchRow()) { $_ret['lon'] = $_row[0]; $_ret['lat'] = $_row[1]; } $_db->disconnect(); return !empty($_ret) ? $_ret : false; }
  3. yea include("config.php"); include("configopen.php"); mysql_close($conn); are part of the script just did not think I needed to post it
  4. mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier. so if multiple queries are not supporeted what would I use. I have script using php to read a database, that passes data to a function that uses the PEAR::DB module to read and write to a differnt table on the same database. If my php query respondes with more the 1 result I get Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' Warning: mysql_query(): A link to the server could not be established if I disable the pear part it works fine, if I disable the mysql_query() and feed it static info it works fine. they just will not work together. any suggestions? Thanks here is my query $query = "SELECT user_id, user_name FROM e107_user WHERE user_name like 'somedata%'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $userid = $row['user_id']; $query2 = "SELECT user_location FROM e107_user_extended WHERE user_extended_id = $userid"; $result2 = mysql_query($query2); while($row2 = mysql_fetch_assoc($result2)) { $loc = $row2['user_location']; }
  5. thanks for all your help. Maybe someone can move this to the correct sub forum. I am sorry that I put it in the wrong forum I am using 2 different database's. one for the geocode caching another that has a user database from my cms. The class came scripted to read and write the cache from a databse. Pulling locations it does not. It looks for these lines in the main file.] map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>'); $map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','<b>Old Chicago</b>'); $map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>"); I haved added my own code to pull the info from the database that has the information in it. here is my code $query = "SELECT user_id, user_name FROM e107_user where user_name = 'john doe'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $map2 = 'addMarkerByAddress('; $userid = $row['user_id']; $query2 = "SELECT user_location FROM e107_user_extended where user_extended_id = $userid"; $result2 = mysql_query($query2); while($row2 = mysql_fetch_assoc($result2)) { $loc = $row2['user_location']; $map2 .=$loc; } $name= $row['user_name']; //echo $name; //echo $row['user_name']; $map2 .= ','; $map2 .= $name; $map2.= ','; $map2 .= $name; $map2.= ') '; $map2 .= '<br />'; } $map->$map2; echo $map; mysql_query($query) or die('Error, insert query failed'); mysql_close($conn); The data is pulling correctly from the database. So how would I send the data to the class.
  6. thank you for your reply ok so the script has these lines of code $map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>'); $map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','<b>Old Chicago</b>'); $map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>"); what would be the best way to pull the info from the datbase? I have the information from my sql statements, and I am looping through the code to pull all if the info
  7. I am using a google API script to show a map with many points. I am pulling city and state and names from a mysql database. I can pull the info correctly, but can't seem to format the $var properly it should look like $map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>'); and I have these vars $loc $name I have tried $map2 = 'addMarkerByAddress('; $map2 .=$loc; $map2 .= ','; $map2 .= $name; $map2.= ','; $map2 .= $name; $map2.= ') '; $map->$map2; when I echo it it looks correct, but does not pas the var to the script properlly. I think I am formating it for viewing not sure. also what does -> mean in PHP thanks
  8. <SELECT NAME="Subject"> <OPTION SELECTED>List Item 1</OPTION> <OPTION>List Item 2</OPTION> <OPTION>List Item 3</OPTION> </SELECT>
  9. can you send me a link so I may see the page
  10. ok yes  you just have to construct  you where query then you if when you display them
  11. not the way you have your datbase setup.  you have 1 product 1 stock level    you need 1 product ---options---\ ----------------------options 1  ------stock level ----------------------options 2  ------stock level Oscommerece has these features built in and it is open source{free}
  12. just join the prod_size table in your query an then add  to your where stament and where stock_level < 0 something likek that should work
  13. In order to really help you could you please post site code, examples,  someting.  your question is so broad that it is very diffacult to answer. but if I understand what you mean you could create a page that queries the database for all blogs from october. if you need help with the query post some of your code.
  14. [quote author=HuggieBear link=topic=110697.msg448063#msg448063 date=1160149859] How are you propogating the array? Regards Huggie [/quote] what do you mean?
  15. WOW thank you all so much for your help. now this array seems very comlicated to me as it looks like arrays inside arrays [code] Array (     [0] => Array         (             [1DA] => 27.84         )     [1] => Array         (             [1DP] => 24.23         )     [2] => Array         (             [2DA] => 14.33         )     [3] => Array         (             [3DS] => 10.60         )     [4] => Array         (             [GND] => 6.65         ) ) [/code] it is the return values for ups quotes.  I need to alter it.  the text is the shipping type and the numbers is the cost.  I need to subtract the value associted with the GND  from all the other vales in the array I tried "for each" but I am lost any sugestion thanks
  16. I have an array and I am not sure what is in it or how deep it is or what the seperater is.  is there any way to just dump an array? if you echo the array it displays ARRAY if I use explode  I get nothing as I m not sure what the seperater is Thanks
  17. echo out $id and make sure it is getting that
  18. try this [code] $products_array = array(); $products_query = tep_db_query("select products_id, products_name, products_model from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");     while ($products = tep_db_fetch_array($products_query)) {       $model = $products['products_model'];     } if ($model == 'm1'){   include(form.php); }else{ echo ''; } [/code] edit had typo
  19. wherein checkout_success.php are you putting the code?
  20. [quote author=printf link=topic=110240.msg445239#msg445239 date=1159798350] What is happening? Where is this being set [b]$upsQuote[$i][/b], and what does it contain? me! [/quote] that is comming from ups here is the whole page. [code] class ups {     var $code, $title, $descrption, $icon, $enabled, $types; // class constructor     function ups() {       global $order;       $this->code = 'ups';       $this->title = MODULE_SHIPPING_UPS_TEXT_TITLE;       $this->description = MODULE_SHIPPING_UPS_TEXT_DESCRIPTION;       $this->sort_order = MODULE_SHIPPING_UPS_SORT_ORDER;       $this->icon = DIR_WS_ICONS . 'shipping_ups.gif';       $this->tax_class = MODULE_SHIPPING_UPS_TAX_CLASS;       $this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);       if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_UPS_ZONE > 0) ) {         $check_flag = false;         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_UPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");         while ($check = tep_db_fetch_array($check_query)) {           if ($check['zone_id'] < 1) {             $check_flag = true;             break;           } elseif ($check['zone_id'] == $order->delivery['zone_id']) {             $check_flag = true;             break;           }         }         if ($check_flag == false) {           $this->enabled = false;         }       }       $this->types = array('1DA' => 'Next Day Air',                                                                     'GND' => ' <font color="red">FREE Ground</font>');    } // class methods     function quote($method = '') {       global $HTTP_POST_VARS, $order, $shipping_weight, $shipping_num_boxes;       if ( (tep_not_null($method)) && (isset($this->types[$method])) ) {         $prod = $method;       } else {         $prod = 'GNDRES';       }       if ($method) $this->_upsAction('3'); // return a single quote       $this->_upsProduct($prod);       $country_name = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true);       $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);       $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);       $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);       $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);       $this->_upsWeight($shipping_weight);       $this->_upsRescom(MODULE_SHIPPING_UPS_RES);       $upsQuote = $this->_upsGetQuote();       if ( (is_array($upsQuote)) && (sizeof($upsQuote) > 0) ) {         $this->quotes = array('id' => $this->code,                               'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');         $methods = array();         $qsize = sizeof($upsQuote);               //new gnd only start         for ($i=0; $i<$qsize; $i++) { list($type, $cost) = each($upsQuote[$i]); if($type == 'GND'){$groundcost = $cost;} if( isset($this->types[$type]) ) { $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes); } }         //end foreach ($methods as $key => $val){         echo $methods[$key]['cost'];         }         foreach ($methods as $key => $val){         $methods[$key]['cost'] -= $groundcost;         }         $this->quotes['methods'] = $methods;         if ($this->tax_class > 0) {           $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);         }       } else {         $this->quotes = array('module' => $this->title,                               'error' => 'An error occured with the UPS shipping calculations.<br>' . $upsQuote . '<br>If you prefer to use UPS as your shipping method, please contact the store owner.');       }       if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);       return $this->quotes;     }     function check() {       if (!isset($this->_check)) {         $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_UPS_STATUS'");         $this->_check = tep_db_num_rows($check_query);       }       return $this->_check;     }     function install() {       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable UPS Shipping', 'MODULE_SHIPPING_UPS_STATUS', 'True', 'Do you want to offer UPS shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('UPS Pickup Method', 'MODULE_SHIPPING_UPS_PICKUP', 'CC', 'How do you give packages to UPS? CC - Customer Counter, RDP - Daily Pickup, OTP - One Time Pickup, LC - Letter Center, OCA - On Call Air', '6', '0', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('UPS Packaging?', 'MODULE_SHIPPING_UPS_PACKAGE', 'CP', 'CP - Your Packaging, ULE - UPS Letter, UT - UPS Tube, UBE - UPS Express Box', '6', '0', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Residential Delivery?', 'MODULE_SHIPPING_UPS_RES', 'RES', 'Quote for Residential (RES) or Commercial Delivery (COM)', '6', '0', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_UPS_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_UPS_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_UPS_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_SHIPPING_UPS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");     }     function remove() {       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");     }     function keys() {       return array('MODULE_SHIPPING_UPS_STATUS', 'MODULE_SHIPPING_UPS_PICKUP', 'MODULE_SHIPPING_UPS_PACKAGE', 'MODULE_SHIPPING_UPS_RES', 'MODULE_SHIPPING_UPS_HANDLING', 'MODULE_SHIPPING_UPS_TAX_CLASS', 'MODULE_SHIPPING_UPS_ZONE', 'MODULE_SHIPPING_UPS_SORT_ORDER');     }     function _upsProduct($prod){       $this->_upsProductCode = $prod;     }     function _upsOrigin($postal, $country){       $this->_upsOriginPostalCode = $postal;       $this->_upsOriginCountryCode = $country;     }     function _upsDest($postal, $country){       $postal = str_replace(' ', '', $postal);       if ($country == 'US') {         $this->_upsDestPostalCode = substr($postal, 0, 5);       } else {         $this->_upsDestPostalCode = $postal;       }       $this->_upsDestCountryCode = $country;     }     function _upsRate($foo) {       switch ($foo) {         case 'RDP':           $this->_upsRateCode = 'Regular+Daily+Pickup';           break;         case 'OCA':           $this->_upsRateCode = 'On+Call+Air';           break;         case 'OTP':           $this->_upsRateCode = 'One+Time+Pickup';           break;         case 'LC':           $this->_upsRateCode = 'Letter+Center';           break;         case 'CC':           $this->_upsRateCode = 'Customer+Counter';           break;       }     }     function _upsContainer($foo) {       switch ($foo) {         case 'CP': // Customer Packaging           $this->_upsContainerCode = '00';           break;         case 'ULE': // UPS Letter Envelope           $this->_upsContainerCode = '01';           break;         case 'UT': // UPS Tube           $this->_upsContainerCode = '03';           break;         case 'UEB': // UPS Express Box           $this->_upsContainerCode = '21';           break;         case 'UW25': // UPS Worldwide 25 kilo           $this->_upsContainerCode = '24';           break;         case 'UW10': // UPS Worldwide 10 kilo           $this->_upsContainerCode = '25';           break;       }     }     function _upsWeight($foo) {       $this->_upsPackageWeight = $foo;     }     function _upsRescom($foo) {       switch ($foo) {         case 'RES': // Residential Address           $this->_upsResComCode = '1';           break;         case 'COM': // Commercial Address           $this->_upsResComCode = '2';           break;       }     }     function _upsAction($action) {       /* 3 - Single Quote          4 - All Available Quotes */       $this->_upsActionCode = $action;     }     function _upsGetQuote() {       if (!isset($this->_upsActionCode)) $this->_upsActionCode = '4';       $request = join('&', array('accept_UPS_license_agreement=yes',                                  '10_action=' . $this->_upsActionCode,                                  '13_product=' . $this->_upsProductCode,                                  '14_origCountry=' . $this->_upsOriginCountryCode,                                  '15_origPostal=' . $this->_upsOriginPostalCode,                                  '19_destPostal=' . $this->_upsDestPostalCode,                                  '22_destCountry=' . $this->_upsDestCountryCode,                                  '23_weight=' . $this->_upsPackageWeight,                                  '47_rate_chart=' . $this->_upsRateCode,                                  '48_container=' . $this->_upsContainerCode,                                  '49_residential=' . $this->_upsResComCode));       $http = new httpClient();       if ($http->Connect('www.ups.com', 80)) {         $http->addHeader('Host', 'www.ups.com');         $http->addHeader('User-Agent', 'osCommerce');         $http->addHeader('Connection', 'Close');         if ($http->Get('/using/services/rave/qcostcgi.cgi?' . $request)) $body = $http->getBody();         $http->Disconnect();       } else {         return 'error';       }       $body_array = explode("\n", $body);       $returnval = array();       $errorret = 'error'; // only return error if NO rates returned       $n = sizeof($body_array);       for ($i=0; $i<$n; $i++) {         $result = explode('%', $body_array[$i]);         $errcode = substr($result[0], -1);         switch ($errcode) {           case 3:             if (is_array($returnval)) $returnval[] = array($result[1] => $result[8]);             break;           case 4:             if (is_array($returnval)) $returnval[] = array($result[1] => $result[8]);             break;           case 5:             $errorret = $result[1];             break;           case 6:             if (is_array($returnval)) $returnval[] = array($result[3] => $result[10]);             break;         }       }       if (empty($returnval)) $returnval = $errorret;       return $returnval;     }   } ?> [/code]
  21. ok so I have the default array of which types of shipping methodes I would like to allow [code] $this->types = array('1DA' => 'Next Day Air',                                '2DA' => '2nd Day Air',                                'GND' => ' <font color="red">Ground</font>'); [/code] then I have this to only use the allowed types and also pulled out the ground cost [code] for ($i=0; $i<$qsize; $i++) {         list($type, $cost) = each($upsQuote[$i]);         if($type == 'GND'){$groundcost = $cost;}                                        if( isset($this->types[$type]) ) {         $methods[] = array('id' => $type,         'title' => $this->types[$type],         'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);         }         } [/code] Then subtracted the ground cost from all costs in the array [code]foreach ($methods as $key => $val){             $methods[$key]['cost'] -= $groundcost;         }[/code] it does not seem to work properly any clues
  22. I have been searching for how to write a join statement in php. all I could find is how to do it in mysql anybody know how to for a join script? thanks
  23. [!--quoteo(post=360454:date=Mar 31 2006, 02:35 PM:name=JackJack)--][div class=\'quotetop\']QUOTE(JackJack @ Mar 31 2006, 02:35 PM) [snapback]360454[/snapback][/div][div class=\'quotemain\'][!--quotec--] What PHP code could I use to count something like wins and loses? [/quote] well where is the data? and how is it getting there?
  24. [!--quoteo(post=360451:date=Mar 31 2006, 02:28 PM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Mar 31 2006, 02:28 PM) [snapback]360451[/snapback][/div][div class=\'quotemain\'][!--quotec--] Is there a common field to link the 2 tables. You need to have something to link the 2 together. Give a little snippet of your table structure and field names. Ray [/quote] yes table user has user_id user_name table user_extended has user_extended_id user_xfire user_extended_id and user_id are the same rather the user ID of the user. so I want to get the user_name of the user_id that is the same id as user_extended_id
  25. [!--quoteo(post=360426:date=Mar 31 2006, 12:50 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 31 2006, 12:50 PM) [snapback]360426[/snapback][/div][div class=\'quotemain\'][!--quotec--] Umm, thats for coldfusion which is totally different to PHP! [/quote] umm you asked whether London is on DST or not I gave you and answer. Maybe you should rephrase your question.
×
×
  • 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.