Jump to content


  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender

Contact Methods

  • Yahoo

sandeep529's Achievements


Member (2/5)



  1. I think you could join that table to itself . If the table name is dimensions, you can use something like Select * from dimensions as `a` join dimensions as `b` on (`a`.`item_id` = `b`.`item_id` and `a`.`high_low_param` ='high' and `b`.`high_low_param` = 'low') where `a`.`length` < 12 and `b`.`length` >6
  2. Try, list($var1,$var2) = explode('~'," This is not I would like to do ~ what do you mean"); echo $var1; echo $var2;
  3. are you looking for something like this.. http://www.phpclasses.org/browse/file/26537.html This class I made specifically to shorten syntax for Database operations...
  4. Will this work...? This uses the class I mentioned in previous message.... $blog = array( array('name'=>'entry 1','title'=>'title 1','type'=>'misc') , array('name'=>'entry 2','title'=>'title 2','type'=>'misc2','anotherEntry'=>'entry content') ); include 'crXml.php'; $crxml = new crxml; foreach($blog as $c => $entry) { foreach($entry as $k=>$v) { $crxml->item[$c]->$k = $v; } } echo $crxml->xml(); Outputs <?xml version="1.0" encoding="UTF-8"?> <item> <name>entry 1</name> <title>title 1</title> <type>misc</type> </item> <item> <name>entry 2</name> <title>title 2</title> <type>misc2</type> <anotherEntry>entry content</anotherEntry> </item> Just replace the blog array with any content from your blog.....
  5. Do you want to provide an rss feed to the user, or you want to use data from external RSS feeds to be displayed in your site? RSS is basically xml so what you will need to do will be XML parsing or XML generation...you can try SimpleXML or DOM XML functions... There is also a class I have created for xml parsing/generation/manipulation called crXml, the usage of which I have outlined in the thread http://www.phpfreaks.com/forums/index.php?topic=351131.msg1657792#msg1657792
  6. I am sorry, but the docuementation for the above class CRXML at crxml.pagodabox.com in under construction... please refer to http://www.phpclasses.org/browse/file/34394.html for complete documentation. Sandeep...
  7. hi, Your XML contains a bit of namespaces, So if you find simpleXML difficult, you can try using a class I created. Which makes accessing CDATA sections and namespaces easy/ http://crxml.pagodabox.com/ You can download the archive at http://crxml.pagodabox.com/crxml.tar The advantage of this class is that you have a search function. You can call it with a name 'visibility' and it will return the php statement using this class that you can use to access the value of that node. for example after loading your xml into the class , the statemment var_dump($crxml->search('visibility')); will output array with 1 element. array(1) { [0]=> array(7) { ["nodeName"]=> string(10) "visibility" ["accessStatement"]=> string(85) "...->dwml->data[1]->parameters->weather->{'weather-conditions'}[1]->value->visibility" ["nodeChildrenCount"]=> int(1) ["nodeType"]=> int(1) ["namespaceURI"]=> NULL ["nodeContent"]=> string(52) "<visibility units="statute miles">10.00</visibility>" ["htmlEncodedNodeContent"]=> string(74) "<visibility units="statute miles">10.00</visibility>" } } In the above section there is a "accessStatement" element....this contains value "->dwml->data[1]->parameters->weather->{'weather-conditions'}[1]->value->visibility" so to access the value of that node from php you can use echo $crxml->->dwml->data[1]->parameters->weather->{'weather-conditions'}[1]->value->visibility; will echo 10. to get the 'Units' attribute for visibility you can give as echo $crxml->dwml->data[1]->parameters->weather->{'weather-conditions'}[1]->value->visibility['units'] will echo 'statute miles'... This way you dont have to manually find your way through the XML. What ever you can do with simpleXML like iterating, You can do with this class also. I have to warn you that even though I have somewhat tested and is activity developing this class, I am the only one working on this. So you might want to try simplexml first. Even though it seems a bit hard to me, people have been using it for long, and there will be solutions in the net for what ever issue you come up with. Or try using DOM XML functions. Its What I have used to make the above class. I Have found it much more consistent and powerful. If you use DOM function, you better take a look at XPath also http://www.tizag.com/xmlTutorial/xpathtutorial.php. If you choose to use simpleXML pls see the link http://blog.preinheimer.com/index.php?/archives/172-SimpleXML,-Namespaces-Hair-loss.html That is not meant to scare you. But it shows how to access xml nodes when namespaces are involved Good Luck.....
  8. Hi, Thanks for checking... But when I am logged in it is showing as awaiting approval... Here I am attaching a screenshot...
  9. hi, I have started a thread with title 'Need some testing for this very Short XML beautifier in PHP' in the beta testing forum, and it is neither deleted nor approved. Please let me know what is happening?
  10. its hexadecimal notation... 0x01111111 = 17895697 Please see language.types.integer.php
  11. I love strtotime()..its a great function. I was just curious if string comparision will work under any circumstances. I nevertheless always use date functions for all date/time comparisons
  12. I was actually expecting something like var_dump('2012-01-05' > '2012-1-4'); The above statement returns false. But with preceding zeros for the second date it returns true. So that pretty much settles it...Thank you Adam...
  13. I have created this short function for formatting xml strings using recursion and anonymous function. Can you guys check and tell me if it is really working...? Also if this can be done in a shorter way? Please avoid the xml version tags and the style sheet declarations for now, as it would break the function. I have included a sample xml in the code posted below... <?php $xmlstr = <<<EOB <Item xmlns="http://uriofthenamespace.com" Type="Book"><Name>Freedom at Midnight</Name><Authors><Author><FirstName>Collins</FirstName><LastName>Larry</LastName></Author><Author><FirstName>Lapierre</FirstName><LastName>Dominique</LastName></Author></Authors><Price><![CDATA[150.00]]></Price></Item> EOB; function indent($str,$il=0,&$count=null) { $indentChar = " "; $str = preg_replace("#>\s*(\w|<)#",">\\1",$str); $replacer = function($str) use($il,$indentChar) { $str[3] = trim($str[3]); $count = 0; if(substr($str[3],0,9)!='<![CDATA[') $str[3] = indent($str[3],$il+1,$count); $n=$count?"":"\n$indentChar"; $str[3] = str_replace("\n","\n".str_repeat($indentChar,$il),$str[3]); return "\n{$str[1]}$n{$str[3]}\n</{$str[2]}>"; }; $return = preg_replace_callback("#(<(\w*?).*>)(.*)</\\2>#Uism",$replacer,$str,-1,$count); if($il==0) return preg_replace("#(<\w*/>)([^<]+)\n(\s*)<#Uism","\\1\n\\3$indentChar\\2\\3\n\\3<",preg_replace("#(<\w*/>)\n(\s*)(\S)#Uism","\n$indentChar\\2\\1\n\\2\\3",$return)); else return $return; } echo indent($xmlstr);
  • 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.