Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. This have been covered quite a few times So heres Very Quick example <?php $A = array("One", "Two", "Three"); echo "<table>"; $col[0] = "#FF0000"; //Red $col[1] = "#0000FF"; //Blue $c =0; foreach($A as $R) { $c = ($c==1)?0:1; echo "<tr bgcolor=\"{$col[$c]}\">"; echo "<td>$R</td>"; echo "</tr>"; } echo "</table>"; ?>
  2. Wonder no more.. i posted one awhile back Heres the link
  3. Okay try this <?php $language = "english"; //// only want to change here function lang($eng,$chn) { global $language; if ($language == "english") { echo $eng; }else{ echo $chn; } } lang("english","chinese"); ?>
  4. Yeah its a good app, but you still need to know the syntax, as the builder messes up alot
  5. it maybe better to use OOP or even sessions it really depends on what your doing but you can use global access it ie <?php $language = "english"; //// only want to change here function lang($eng,$chn){ global $language; if ($language == "english") echo $eng; else echo $chn; } lang(english,chinese); ?>
  6. Cool RegEx's get easier with pratice but it can be hell as well
  7. May fail on a very large file.. depends on memory and timeouts but <?php file_put_contents("SmallFile.txt",array_unique(split("\n", file_get_contents("LargeFile.txt")))); ?> EDIT: LOL may fail on small files.. yeah mean very large
  8. Okay just tested one (slight update) <?php $oldxStuff = ' <b>just saw darren perform on broadway with movin out. he was amazing. he would make billy joel proud. congrats darren.</b><br> anthony sharkey <sharkeyanthony@aol.com><br> USA - Thursday, September 11, 2003 at 17:23:17 (EDT)<hr> <b>Hey Darren, Congratulations on your Broadway successes as well. Best, Tad</b><br> Tad <info@globaldog.com><br> Nashville, TN USA - Saturday, September 06, 2003 at 10:42:56 (EDT)<hr>'; preg_match_all("%<[^>]+>([^>]*)</[^>]+><br>\s*(.*?)\s<.*?;<br>\s*(.*?)\s-\s(.*?)<hr>%si",$oldxStuff,$out,PREG_SET_ORDER); foreach($out as $input) { echo "<br>LINE1: ".htmlspecialchars($input[1])."<br>------------------------------------------------------<br>"; echo "<br>LINE2: ".htmlspecialchars($input[2])."<br>------------------------------------------------------<br>"; echo "<br>LINE3: ".htmlspecialchars($input[3])."<br>------------------------------------------------------<br>"; echo "<br>LINE4: ".htmlspecialchars($input[4])."<br>------------------------------------------------------<br>"; } ?> output
  9. That look correct.. try changing the output ie echo "<br>LINE1: ".htmlspecialchars($input[1])."<br>------------------------------------------------------<br>"; echo "<br>LINE2: ".htmlspecialchars($input[2])."<br>------------------------------------------------------<br>"; etc
  10. PREG_PATTERN_ORDER should be PREG_SET_ORDER example <?php $oldStuff = ' <b>Hey Darren, Congratulations on your Broadway successes as well. Best, Tad</b><br> Tad <info@globaldog.com><br> Nashville, TN USA - Saturday, September 06, 2003 at 10:42:56 (EDT)<hr>'; preg_match_all("%<[^>]+>(.*)</[^>]+><br>\s*(.*?)\s<.*?;<br>\s*(.*?)\s-\s(.*?)<hr>%si",$oldStuff,$out,PREG_SET_ORDER); foreach($out as $input) { echo $input[1].","; echo $input[2].","; echo $input[3].","; echo $input[4]."<br>"; } ?>
  11. Humm try this <?php preg_match_all("%<[^>]+>(.*)</[^>]+><br>\s*(.*?)\s<.*?;<br>\s*(.*?)\s-\s(.*?)<hr>%si",$oldStuff,$out,PREG_PATTERN_ORDER); foreach($out as $input){ echo $input[1].","; echo $input[2].","; echo $input[3].","; echo $input[4]."<br>"; } ?>
  12. Click Solved (bottom left) i think please remember you have Magic Quotes (Now DEPRECATED) turned on.. read here
  13. Have you tried my last post ? Oh an heres GKWelding example rewritten $noQuotes = preg_replace('/"(head)"/si', '\1', $_POST['head']);
  14. Heres my idea.. <?php $stripped_quotes = RemoveQuotes($_POST['head']); function RemoveQuotes($string) { if(get_magic_quotes_gpc()) { return str_replace('"','',stripslashes($string)); } else { return str_replace('"','', $string); } } ?>
  15. try this <?php class Whatever { private $ten = 10; // function whatever has a variable function Whatever( $variable ) { return $variable + $this->ten; } // I need to get that variable into this function, how?? function AnotherFunction() { echo $this->ten; } function YetAnotherFunction() { $this->ten = 5; //LOL } } ?>
  16. You could trace the script for the part that removes the html or maybe post it here (or link to download it) or Search the script for the commands below:~ Strip_tags( htmlentities( htmlspecialchars( these are the most likely commands used to remove HTML code.. removing the command may solve your problem
  17. This is how I work, I either charge per project or per day/hour and give an estimated time, Normally I have to sign a NDA (Non-disclosure agreement) The cost will variety from project to project, and if I esitmated the project will take 3 days the client can choose to pay for the time spent or a fixed cost the fixed cost will more then 3 days at a day rate.. Example: Est. 3 days work Options $250 per day or $1250 Set Project (i'm based in the UK.. but used dollars so rate above a probably missleading) Now if the client choose to take the Set Project price (which is the same as 5 day) and it took me 10 days the client would pay $1250 but if they picked the day rate it would be $2500.. (so its a good idea for me to get a good esitmate) The amount the programmer can charge depends on lots of things, but the main thing really is how good they are.. (also how busy lol) I know this doesn't help with the (am i being ripped off factor) but as i said i charge depending on the project.. Hope this help's a little --MadTechie
  18. Just a quick version but it should give you a starting point (but it also may work) try this *untested* <?php $kebase = '//asecasianas2/DS_Keying/STATS/KE-DIR/'; $qcbase = '//asecasianas2/DS_Keying/STATS/QC-DIR/'; $dir = 'SC41001A'; $kedir = $kebase . $dir; $qcdir = $qcbase . $dir; $kefiles = scandir($kedir); $qcfiles = scandir($qcdir); $count_files = count($qcfiles); echo $count_files . " " . "files found" . " " . "in" . " " . $dir . " " . "directory" . "<br>"; echo "<table border=\"0\" >\n"; echo "<tr>\n"; echo "<td>Line</td>\n"; echo "<td>KE address</td>\n"; echo "<td>QC address</td>\n"; echo "</tr>\n"; for($i = 2; $i <= $count_files; $i++) { echo $qcfiles[$i] . "<br>"; $file1 = file($kedir . "/" . $kefiles[$i]); $file2 = file($qcdir . "/" . $qcfiles[$i]); $file1_count = count($file1); $file2_count = count($file2); $count = 1; for($x = 0; $x <= $file2_count; $x++) { $vtag1 = substr($file1[$x],178,1); $vtag2 = substr($file2[$x],178,1); $page1 = substr($file1[$x],0,4); $page2 = substr($file2[$x],0,4); $name1 = substr($file1[$x],7,78); $name2 = substr($file2[$x],7,78); $addr1 = substr($file1[$x], 1, 78); $addr2 = substr($file2[$x], 1, 78); $city1 = substr($file1[$x], 79, 30); $city2 = substr($file2[$x], 79, 30); $state1 = substr($file1[$x], 110, 2); $state2 = substr($file2[$x], 110, 2); $zc1 = substr($file1[$x], 112, 5); $zc2 = substr($file2[$x], 112, 5); $tf1 = substr($file1[$x], 123, 40); $tf2 = substr($file2[$x], 123, 40); $phone1 = substr($file1[$x], 164, 12); $phone2 = substr($file2[$x], 164, 12); if($vtag2 == 1) { $name_comp = strcmp($name1, $name2); if($name_comp != 0) { //echo "line".$count."error name" . "<br>"; $err_stat = 1; $Error = 1; $err_line = $count; $err_name1 = $name1; $err_name2 = $name2; echo "<tr>\n"; echo "<td>$err_line</td>\n"; echo "<td>$err_name1</td>\n"; echo "<td>$err_name2</td>\n"; echo "</tr>\n"; } }else{ $addr_comp = strcmp($addr1, $addr2); $city_comp = strcmp($city1, $city2); $state_comp = strcmp($state1, $state2); $zc_comp = strcmp($zc1, $zc2); $tf_comp = strcmp($tf1, $tf2); $phone_comp = strcmp($phone1, $phone2); if($addr_comp != 0) { $Error = 1; $err_line = $count; $err_addr1 = $addr1; $err_addr2 = $addr2; echo "<tr>\n"; echo "<td>$err_line</td>\n"; echo "<td>$err_name1</td>\n"; echo "<td>$err_name2</td>\n"; echo "</tr>\n"; } if($city_comp != 0) { $Error = 1; $err_line = $count; $err_city1 = $city1; $err_city2 = $city2; echo "Line" . $err_line . " " . "KE City" . " " . $err_city1 . "<br>"; echo " QC City" . " " . $err_city2 . "<br>"; } if($state_comp != 0) { $Error = 1; $err_line = $count; $err_state1 = $state1; $err_state2 = $state2; echo "Line" . $err_line . " " . "KE State" . " " . $err_state1 . "<br>"; echo " QC State" . " " . $err_state2 . "<br>"; } if($zc_comp != 0) { $Error = 1; $err_line = $count; $err_zc1 = $zc1; $err_zc2 = $zc2; echo "<tr>\n"; echo "<td>$err_line</td>\n"; echo "<td>$err_name1</td>\n"; echo "<td>$err_name2</td>\n"; echo "</tr>\n"; } if($tf_comp != 0) { $Error = 1; $err_line = $count; $err_tf1 = $tf1; $err_tf2 = $tf2; echo "Line" . $err_line . " " . "KE Toll Free Text" . " " . $err_tf1 . "<br>"; echo " QC Toll Free Text" . " " . $err_tf2 . "<br>"; } if($phone_comp != 0) { $Error = 1; $err_line = $count; $err_phone1 = $phone1; $err_phone2 = $phone2; echo "<tr>\n"; echo "<td>$err_line</td>\n"; echo "<td>$err_name1</td>\n"; echo "<td>$err_name2</td>\n"; echo "</tr>\n"; } } $count++; } } echo "</table>"; ?>
  19. okay i assume you didn't want that then lol, in any case you can just move down a dir by adding ../ ie include(dirname(__FILE__)."/../header.php")
  20. You can't move it, It was moved here becuase he belongs here and not in PHP Help,
  21. can you post your full SQL statement
  22. use mysql_real_escape_string() it changes it to \' in the database but when you read it back it will be ' as normal
  23. Bug fix.. change the if and remove the echo if(!empty($_GET['action']) && $_GET['action']=='delete') { $query = "DELETE FROM shows WHERE id = '".$_GET['id']."'"; if(!mysql_query($query)) { die ('<p>Could not delete post because ' . mysql_error() . '. The query was '."$query.".'</p>'); } header("http://www.".$_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF']); // you may need to tweak this line }
  24. Sorry akitchin, kinda revenge for all those misread i have done and had a mod slam me.. no harm intended lol
  25. you can't use DATEDIFF() as "Only the date parts of the values are used in the calculation. " i convert to unix time to make my life easier but then again i hate working with dates.. Theirs a few ways.. heres one that will give hour minutes and seconds SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(field1) - UNIX_TIMESTAMP(field2), '%h:%i:%s') as MyTime
×
×
  • 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.