Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. The default is 'CURRENT_TIMESTAMP' so you don't need to pass a value, but if you want to pass it, you need to format it to MySQL time $date = date('Y-m-d H:i:s',time()); OR for default $queryreg = mysql_query("INSERT INTO " . TBL_ACTION . " ( `date`) VALUES (null)")
  2. I'll start you off $HTML = <<<HTML <input type="hidden" name="animal" value="zebra"> <input type="hidden" name="color" value="white"> HTML; preg_match('/<input type="hidden" name="animal" value="([^"]+)">/', $HTML, $regs); $result = $regs[1]; echo $result;
  3. Your very welcome, and welcome to PHP Freaks
  4. My 2cents $raw_data="a customer premises equipment (CPE) z Service provider (SP) y virtual circuits (VC) A Point to Point Tunneling Protocol (PPTP) B Layer 2 Tunneling Protocol (L2TP) 6 IP security (IPsec)"; $split=explode("\n",$raw_data); natcasesort($split); foreach($split as $str){ echo "$str<br/>"; }
  5. Your need to loop the thought the elements or extract it like an arrary I think an example would help. <?php $xmlstr = <<<XML <XML> <Movie> <Movie_Name>Movie 1</Movie_Name> </Movie> <Movie> <Movie_Name>Movie 2</Movie_Name> </Movie> </XML> XML; $xml = simplexml_load_string($xmlstr); $movie = $xml->Movie; echo "MOVIE ONE is:".$movie->Movie_Name; echo "<HR />"; //array starts at 0 so this is item 2 echo "MOVIE TWO is:".$movie[1]->Movie_Name; echo "<HR />"; //Looping (okay the movie to movieS seams weird but i wanted to keep your variable the same!!) //remember $movie is $xml->Movie foreach ($movie as $movies) { echo $movies->Movie_Name, '<br />'; } EDIT: added comment to loop
  6. if PHP fails to do something it will report and error assuming error reporting is on. try error_reporting(E_ALL); ini_set('error_reporting', E_ALL); $fp = fopen('desmond.txt', 'a'); fwrite($fp, 'Top o the morning to ya'); fclose($fp); echo ("Hi Guys");
  7. Here is a simplexml example to extract all, of course you could add a if statement to find the "en_GB".. $XMLData = <<<XML <comments> <comment lang="fr_FR"><![CDATA[lalalalalalalalalalallala]]></comment> <comment lang="en_GB"><![CDATA[hello english descriptions]]></comment> <comment lang="de_DE"><![CDATA[yayayayayayay]]></comment> <comment lang="it_iT"><![CDATA[]]></comment> <comment lang="es_ES"><![CDATA[]]></comment> <comment lang="ru_RU"><![CDATA[]]></comment> <comment lang="no_NO"><![CDATA[]]></comment> </comments> XML; $XML = simplexml_load_string($XMLData); foreach($XML->comment as $element) { $attr = $element->attributes(); echo "ATTR:".$attr['lang']."<BR />\n"; echo "VALUE:$element<BR />\n"; echo "<hr>"; } Hope that helps
  8. its just assigns the array key to ID and the value to task,
  9. You basically have it, assuming you have the form like this <input name="assignment[<?php echo $id; ?>]"> you could be able to do this $assignment = $_POST["assignment"]; foreach ($assignment as $ID => $task) { $q = mysql_query("UPDATE table SET `assignment` = '$task' WHERE `id` = '$ID'");
  10. Ohhh.. i thought you want moving from a buggy server.. call app provider.. tell them to fix it! try this.. (its very basic) <?php $folder = date("mdY"); $count = 30; $target = "target/$folder/"; mkdir($target); mvr("source/$folder/",$target); function mvr($dir,$target){ global $count; if(!$dh = @opendir($dir)) return; while (false !== ($file = readdir($dh))){ if($file == '.' || $file == '..') continue; if(is_dir($dir.'/'.$file)){ mkdir($target.$file); mvr($dir.'/'.$file.'/', $target.$file.'/'); rmdir($dir.$file); }else{ if($count==0) return; rename($dir.$file,$target.$file); $count--; } } closedir($dh); } ?> EDIT: oops updated $count to 30
  11. Erm.. Okay.. and whats that got to do with FTP ? Also whats your preferred file transfer method a push or a pull ?
  12. Again, Whats the error ?
  13. does it work on 0755 or 0777 ?
  14. Why not just FTP them over ?
  15. Doesn't help too much, I'll have to assume the its a permissions problem, check the folder/file has write access, (this doesn't affect Windows, so that's probably the problem.
  16. If thats the case one line should do it! echo "array(".implode(",",$tp).")";
  17. I have had a problem before, with permissions (nothing would write unless it had 0777 permissions), What i did was create a folder with 0777 permissions, then created a script to create a folder inside that with 0755 permissions, and that folder i could write files too, So change the permissions of a folder to 0777, and put the below script inside it, Click create folder. then create file then remove file then change the permissions to the folder (containing the script and change permissions back to 0755 or ) (non-recursive) then test the create file and remove file links <?php $action = $_GET['action']; $thisFolder = dirname(__FILE__)."/"; $file = $thisFolder."tmp/tmp.txt"; $tmpdir = $thisFolder."tmp"; switch($action){ case "mkdir"; echo $tmpdir; mkdir($tmpdir, 0755); break; case "rmdir"; if(file_exists($file)) unlink($file); rmdir($tmpdir); break; case "mkfile": file_put_contents($file,"TESTING",FILE_APPEND); break; case "rmfile": if(file_exists($file)) unlink($file); break; } ?> <a href="?action=mkdir">Make Dir</a><BR /> <a href="?action=rmdir">Remove Dir</a><BR /> <a href="?action=mkfile">Make File</a><BR /> <a href="?action=rmfile">Remove File</a><BR /> <a href="tmp/">See Folder</a><BR /> <a href="tmp/tmp.txt">See File</a><BR /> Hope that helps
  18. What browser are you using.. as it appears fine here.. i tested with a few browsers IE 8 (not 7 as stated in PM) FF 3.5, crome & Safari
  19. Humm.. try creating the folder from PHP mkdir("/path/to/my/dir", 0755) see if that does it
  20. Can you supple more detail, as "not working" doesn't help much! However if its a CSS problem then a new thread in the CSS section would be better..
  21. Which was the first link from the search i supplied, i guess it helps to know what to search for, as "download script" wouldn't give a good results compared to "PHP File Management"
  22. Well technically only the owner needs write access (as PHP is running as the owner) so 755 should be fine.
  23. Your welcome, if this is solved click solved (bottom left) (you can unsolve it if needed) also read the code and play around with it.. so you understand it, any questions i'm sure someone or myself will be happy help. Happy PHPing
  24. 154 post.. so you must know the rules by now.. Try this, first link
×
×
  • 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.