Jump to content

croakingtoad

Members
  • Posts

    65
  • Joined

  • Last visited

    Never

Everything posted by croakingtoad

  1. I am working for a company who uses IIS and MSSQL but I would like to run an open source PHP app that uses MySQL. Forgive my DB ignorance, but is there a wrapper class or anything I could (easily) use without having to rewrite the entire open source apps DB code for MSSQL? Thanks!
  2. Hello Freaks, I am consulting with a company who uses the .NET application framework and programs with C#. They were using ASP.NET for their website but from what I understand they are now using C# and .NET exclusively. I need to justify to them the benefits of switching to PHP for their web development. I know about [a href=\"http://www.php-compiler.net/\" target=\"_blank\"]Phalanger[/a], are there any better solutions for compiling PHP with .NET? Also, any good resources or arguments out there for switching to PHP from their current setup? This is serious, so please, no silly answers like "PHP is better". I am going up against their IT people and need to truly justify the switch. Thanks!
  3. So here's my code that I have (that isn't working)-- [code]         $count = 2;     for ($i = 0; $i <= $count; $i++) {         foreach($_arr[$i] as $key => $row) {             if($key != 0) {             echo "Value to insert- $_arr[$i][3]<br />";                 mysql_query ("INSERT INTO $sql_table (mls) VALUES ('$_arr[$i][3]') ");             } #endof if         } #endof foreach     } #endof for [/code] You can actually see part of the array I'm working with here-- [a href=\"http://roanokehousehunter.com/cron/csv2arrayManual.php\" target=\"_blank\"]http://roanokehousehunter.com/cron/csv2arrayManual.php[/a] I think my looping is off, but basically when I run this script I'm getting this as the result-- [code] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] Value to insert- Array[3] [/code] And it's inserting "Array[3]" into the database fields. If you look at array[1][3] the value is "601815", that and corresponding is what I'm going for here...what am I doing wrong?
  4. I'm getting this error-- Warning: Invalid argument supplied for foreach() in /home/hunter/public_html/cron/csv2arrayManual.php on line 13 Any idea what's causing it? [code]<? // csv to array parser include_once '../classes/class.csv.php'; $document = 'rva-1.20060313.1107.dat'; $csv = & new csv("$document", ',', '"' , '\\'); $_arr = $csv->csv2Array(); $_arr2 = array(); //echo '<pre>' . var_export($_arr,true) . '</pre>'; for ($i = 0; $i <= count($_arr); $i++) {     foreach($_arr[$i] as $key => $row) {         if($key != 0) {             if (strpos($row, '|') !== false) {                 $_arr2[$i][$key] = explode('|', $row);             } else {                 $_arr2[$i][$key] = $row;             }         }     } } echo '<pre>', print_r($_arr2, true), '</pre>'; //print_r($_arr[5][137][1]);  // this one works ?>[/code]
  5. Okay, so I have been working on this but am having problems. Basically what's happening is the loop is only exploding $_arr[1][136]. When it gets to $_arr[1][137] it doesn't explode it into an array and when it gets to any iteration beyond that it doesn't do either $_arr[2+][136] nor $_arr[2+][137] What am I doing wrong here? Here's the code I have-- [code] for ($i = 0; $i <= count($_arr); $i++) {     foreach($_arr[$i] as $key => $row) {         if($key != 0) {             if (strpos($row, '|') !== false) {                 $_arr[$i][$key] = explode('|', $_arr[$i][$key]);                 echo '<pre>' . var_export($_arr,true) . '</pre>';             }         }     } } [/code] Here's the output-- [code]   1 =>   array (     0 => '20051230194116769413000000',     1 => '20060310195836868674000000',     2 => '00',     3 => '500169',     4 => 'Y',     5 => '20060310190340772208000000',     6 => '',     7 => '19990816212109142258000000',     8 => 'Residential',     9 => 'Single Family',     10 => '2005-01-04', ...     135 => 'EUREKA LAND',     136 =>     array (       0 => 'Bedroom 1:',       1 => '',       2 => '',       3 => '',       4 => 'Entry',       5 => ';Bedroom 2:',       6 => '',       7 => '',       8 => '',       9 => 'Entry',       10 => ';Kitchen:',       11 => '',       12 => '',       13 => '',       14 => 'Entry',       15 => ';Living Room:',       16 => '',       17 => '',       18 => '',       19 => 'Entry',       20 => ';',     ),     137 => 'Lot Description|Up Slope|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Heat Pump Electric|Yes;Cooling|Heat Pump Electric|Yes;Fireplace|# Fireplaces|0;Appliances|Refrigerator|Yes;Appliances|Range|Yes;Floors|Carpet|Yes;Floors|Vinyl|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Entry Level|2;Full Baths|Full Baths Entry Lvl|1;',   ),   2 =>   array (     0 => '20051230194116769413000000',     1 => '20060310195730720323000000',     2 => '00',     3 => '410360',     4 => 'Y',     5 => '20060310190426562381000000',     6 => '20060310190217691034000000',     7 => '19990816212109142258000000',     8 => 'Residential',     9 => 'Single Family',     10 => '2004-11-29', ...     135 => '',     136 => 'Breakfast Area:||||Entry|;Dining Room:||||Entry|;Family Room:||||Entry|;Living Room:||||Entry|;Bedroom 2:||||Upper|;Bedroom 3:||||Upper|;Bedroom 4:||||Upper|;Laundry:||||Upper|;Master Bedroom 1:||||Upper|;',     137 => 'Lot Description|Gentle Slope|Yes;Construction|Brick|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Forced Air Gas|Yes;Heating|Heat Pump Electric|Yes;Cooling|Central Cooling|Yes;Fireplace|# Fireplaces|1;Fireplace|Family Room|Yes;Interior Features|Breakfast Area|Yes;Interior Features|Gas Log Fireplace|Yes;Exterior Features|Deck|Yes;Exterior Features|Patio|Yes;Exterior Features|Paved Driveway|Yes;Appliances|Dishwasher|Yes;Appliances|Disposer|Yes;Appliances|Microwave Oven|Yes;Appliances|Garage Door Opener|Yes;Appliances|Oven|Yes;Appliances|Range|Yes;Misc Features|Cable TV|Yes;Misc Features|Maint-Free Exterior|Yes;Misc Features|Underground Util|Yes;Floors|Carpet|Yes;Floors|Vinyl|Yes;Floors|Wood|Yes;Windows|Insulated|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Upper Level|4;Full Baths|Full Baths Upper Lvl|2;Half Baths|Half Baths Entry Lvl|1;',   ), [/code]
  6. Okay, so I have been working on this but am still having problems. Basically what's happening is the loop is only exploding $_arr[1][136]. When it gets to $_arr[1][137] it doesn't explode it into an array and when it gets to any iteration beyond that it doesn't do either $_arr[2+][136] nor $_arr[2+][137] What am I doing wrong here? Here's the code I have-- [code] for ($i = 0; $i <= count($_arr); $i++) {     foreach($_arr[$i] as $key => $row) {         if($key != 0) {             if (strpos($row, '|') !== false) {                 $_arr[$i][$key] = explode('|', $_arr[$i][$key]);                 echo '<pre>' . var_export($_arr,true) . '</pre>';             }         }     } } [/code] Here's the output-- [code]   1 =>   array (     0 => '20051230194116769413000000',     1 => '20060310195836868674000000',     2 => '00',     3 => '500169',     4 => 'Y',     5 => '20060310190340772208000000',     6 => '',     7 => '19990816212109142258000000',     8 => 'Residential',     9 => 'Single Family',     10 => '2005-01-04', ...     135 => 'EUREKA LAND',     136 =>     array (       0 => 'Bedroom 1:',       1 => '',       2 => '',       3 => '',       4 => 'Entry',       5 => ';Bedroom 2:',       6 => '',       7 => '',       8 => '',       9 => 'Entry',       10 => ';Kitchen:',       11 => '',       12 => '',       13 => '',       14 => 'Entry',       15 => ';Living Room:',       16 => '',       17 => '',       18 => '',       19 => 'Entry',       20 => ';',     ),     137 => 'Lot Description|Up Slope|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Heat Pump Electric|Yes;Cooling|Heat Pump Electric|Yes;Fireplace|# Fireplaces|0;Appliances|Refrigerator|Yes;Appliances|Range|Yes;Floors|Carpet|Yes;Floors|Vinyl|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Entry Level|2;Full Baths|Full Baths Entry Lvl|1;',   ),   2 =>   array (     0 => '20051230194116769413000000',     1 => '20060310195730720323000000',     2 => '00',     3 => '410360',     4 => 'Y',     5 => '20060310190426562381000000',     6 => '20060310190217691034000000',     7 => '19990816212109142258000000',     8 => 'Residential',     9 => 'Single Family',     10 => '2004-11-29', ...     135 => '',     136 => 'Breakfast Area:||||Entry|;Dining Room:||||Entry|;Family Room:||||Entry|;Living Room:||||Entry|;Bedroom 2:||||Upper|;Bedroom 3:||||Upper|;Bedroom 4:||||Upper|;Laundry:||||Upper|;Master Bedroom 1:||||Upper|;',     137 => 'Lot Description|Gentle Slope|Yes;Construction|Brick|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Forced Air Gas|Yes;Heating|Heat Pump Electric|Yes;Cooling|Central Cooling|Yes;Fireplace|# Fireplaces|1;Fireplace|Family Room|Yes;Interior Features|Breakfast Area|Yes;Interior Features|Gas Log Fireplace|Yes;Exterior Features|Deck|Yes;Exterior Features|Patio|Yes;Exterior Features|Paved Driveway|Yes;Appliances|Dishwasher|Yes;Appliances|Disposer|Yes;Appliances|Microwave Oven|Yes;Appliances|Garage Door Opener|Yes;Appliances|Oven|Yes;Appliances|Range|Yes;Misc Features|Cable TV|Yes;Misc Features|Maint-Free Exterior|Yes;Misc Features|Underground Util|Yes;Floors|Carpet|Yes;Floors|Vinyl|Yes;Floors|Wood|Yes;Windows|Insulated|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Upper Level|4;Full Baths|Full Baths Upper Lvl|2;Half Baths|Half Baths Entry Lvl|1;',   ), [/code]
  7. Yup...exactly. And then how would I access each subitem in [136] and/or [137]..
  8. Okay, here it is, I've cut out some of the middle because it's a really long array [code] 1 =>   array (     0 => '20051230194116769413000000',     1 => '20060310195836868674000000',     2 => '00',     3 => '500169',     4 => 'Y',     5 => '20060310190340772208000000', .....     135 => 'EUREKA LAND',     136 => 'Bedroom 1:||||Entry|;Bedroom 2:||||Entry|;Kitchen:||||Entry|;Living Room:||||Entry|;',     137 => 'Lot Description|Up Slope|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Heat Pump Electric|Yes;Cooling|Heat Pump Electric|Yes;Fireplace|# Fireplaces|0;Appliances|Refrigerator|Yes;Appliances|Range|Yes;Floors|Carpet|Yes;Floors|Vinyl|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Entry Level|2;Full Baths|Full Baths Entry Lvl|1;',   ), [/code]
  9. Ken, I'm not sure I understand what you're doing but that's my fault! I made a breakthrough (I think) a bit ago, let me show you where I am-- [code] foreach($_arr as $key => $row) {     if($key != 0) {         $_arr[$key][137] = explode("|", $_arr[$key][137]);         print_r("$_arr[$key][137][1]<br />");   // this one doesn't...     } } print_r($_arr[5][137][1]);  // this one works [/code] The print_r in the loop just prints "Array[137][1]" down the page, BUT, the print_r at the bottom actually prints the value of the array, which in this case is "Sloped". What gives?
  10. [!--quoteo(post=355952:date=Mar 17 2006, 12:55 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 17 2006, 12:55 PM) [snapback]355952[/snapback][/div][div class=\'quotemain\'][!--quotec--] Dude.. you don't have a multi dimensional array, at all.. You have a single dimension array. Stop trying to [key][value].. its just Array[0] -> Array[137] [/quote] If you look at key [136] in my original post, you will see the multidimensional array csv'd with pipes | This would be [$key][136][$whatever] [code] [136] => Bedroom 1:||||Entry|;Bedroom 2:||||Entry|;Kitchen:||||Entry|;Living Room:||||Entry|; [137] => Lot Description|Up Slope|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Heat Pump Electric|Yes;Cooling|Heat Pump Electric|Yes;Fireplace|# Fireplaces|0;Appliances|Refrigerator|Yes;Appliances|Range|Yes;Floors|Carpet|Yes; Floors|Vinyl|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Entry Level|2;Full Baths|Full Baths Entry Lvl|1; ) [/code]
  11. [!--quoteo(post=355950:date=Mar 17 2006, 12:49 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 17 2006, 12:49 PM) [snapback]355950[/snapback][/div][div class=\'quotemain\'][!--quotec--] You don't need to put "print_r" in a loop, just use: [code]<?php echo '<pre>' . print_r($array,true) . '</pre>'; ?>[/code] Ken [/quote] Good point. Okay, back to my original problem that Obsidian and kenrbnsn dealt with. I now have this code- [code] foreach($_arr as $key => $row) {     if($key != 0) {         $_arr[$key][137] = explode("|", $_arr[$key][137]);         echo "$_arr[$key][137][0]<br />";     } } [/code] All this is giving me though is- Array[137][0] Array[137][0] Array[137][0] repeated over and over until the end of the loop. What am I doing wrong, why isn't it giving me the value of the array item?
  12. Okay, that makes sense but what about $array[1] ? When I use this code [code] foreach($array as $key => $row) {     print_r("$array[$key][0]<br />"); } [/code] It's just printing-- Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] Array[0] etc....
  13. Okay, so I have this multidimensional array that looks something like-- [code] [1] => Array ( [0] => 20051230194116769413000000 [1] => 20060310195836868674000000 [2] => 00 [3] => 500169 [4] => Y [5] => 20060310190340772208000000 [6] => [7] => 19990816212109142258000000 [8] => Residential [9] => Single Family [10] => 2005-01-04 [11] => [12] => [13] => [14] => [15] => Active [16] => [17] => [18] => [19] => [20] => [21] => [22] => 69950.00 [23] => [24] => [25] => [26] => [27] => [28] => [29] => 5 - Northwest Roanoke City [30] => [31] => 1303 [32] => [33] => [34] => HANOVER [35] => [36] => NW [37] => AVE [38] => [39] => Roanoke [40] => VA [41] => Roanoke City [42] => [43] => 24017 [44] => [45] => [46] => [47] => [48] => 768.00 [49] => 768.00 [50] => 0.00 [51] => 0.00 [52] => 0.00 [53] => 1949 [54] => Cape Cod [55] => [56] => 50 X 117 [57] => 0.00 [58] => [59] => [60] => [61] => [62] => [63] => [64] => [65] => 0 [66] => 2 [67] => [68] => 1 [69] => [70] => [71] => [72] => [73] => N/A [74] => [75] => 394.00 [76] => [77] => EUREKA LAND [78] => COMPLETELY REMODELED-NEW VINYL SIDING,NEW WINDOWS,NEW CARPET & VINYL NEW KITCHEN,NEW HEAT PUMP,NEW PAINT,WALKUP ATTIC COULD BE FINISHED INTO MORE ROOMS [79] => [80] => 2220506 [81] => [82] => 10TH ST TO RIGHT ON HANOVER HOUSE ON RIGHT [83] => [84] => [85] => [86] => Off Street Parking [87] => 2006-03-11 13:08:33.650667 [88] => Exclusive Right to Represent Seller [89] => No [90] => Crawl Space [91] => FRPK [92] => William Ruffner [93] => Fleming [94] => [95] => [96] => [97] => No [98] => 20060311031233373503000000 [99] => [100] => [101] => [102] => [103] => [104] => Y [105] => 20060310190150596090000000 [106] => [107] => [108] => 1303 [109] => -28655552 [110] => -16110225 [111] => [112] => Completed [113] => [114] => [115] => PTS 1&2 [116] => 2 [117] => 0 [118] => N/A [119] => [120] => [121] => 0.00 [122] => 2.00 [123] => 0.00 [124] => [125] => [126] => [127] => [128] => [129] => 0.00 [130] => [131] => [132] => [133] => [134] => [135] => EUREKA LAND [136] => Bedroom 1:||||Entry|;Bedroom 2:||||Entry|;Kitchen:||||Entry|;Living Room:||||Entry|; [137] => Lot Description|Up Slope|Yes;Construction|Vinyl|Yes;Miscellaneous Info|Single Wide|No;Miscellaneous Info|Double Wide|No;Heating|Heat Pump Electric|Yes;Cooling|Heat Pump Electric|Yes;Fireplace|# Fireplaces|0;Appliances|Refrigerator|Yes;Appliances|Range|Yes;Floors|Carpet|Yes;Floors|Vinyl|Yes;Windows|Tilt-In|Yes;Exterior Doors|Insulated|Yes;Porch|Front Porch|Yes;Water Description|Public Water|Yes;Sewer Description|Public Sewer|Yes;Bedrooms|Bedrooms Entry Level|2;Full Baths|Full Baths Entry Lvl|1; ) [/code] Now if you look at [137] you will see it also contains an array with '|' as the delimiter. I have two questions. How do I get the value of [1] and how do I get the values of the array items within [137]? As for how to get the value of [1] I have something like this-- $array[$key][1] but all that is giving me when I print_r it is "array[1]". And I haven't the slightest idea where to begin on my second question. Thanks for the help!
  14. I have a service that is ftp-pushing one file per day into my site and I need to write some PHP to set the filename as a variable. Here's the structure of a file's name-- rva-1.20060313.1107.zip The first part 'rva-1' will always be that. The second part '20060313' is obviously the current date and I can easily calculate that. The last part 'zip' will also always be that. The problem is the '1107'. That is a time stamp and will likely always be different. I suppose I need to create an array by searching the directory with something like [code] $array = scandir(/tmp); [/code] That could be completely the wrong way to start, can someone give me a hand on how to find out first if that file is in there yet, and if so, to set a var of $fileName with the file's name... Thanks in advance!
  15. I have exhausted myself looking for the mistake I've made, can someone take a look at the contact table on this page and figure out why the rows aren't working right? [a href=\"http://www.roanokehousehunter.com/contact.php\" target=\"_blank\"]http://www.roanokehousehunter.com/contact.php[/a] The email row and everything below it seem to be running together instead of being in separate rows. I can't figure out what the H i'm missing... Thanks!
×
×
  • 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.