Jump to content

benjaminbeazy

Members
  • Posts

    460
  • Joined

  • Last visited

    Never

Everything posted by benjaminbeazy

  1. i dont have any friends so can u plz check to see if this url loads anything... http://benjaminmurphy.cjb.net/
  2. you echo statement.. echo "</ul>" is missing semicolon
  3. ini_set('memory_limit', '16M'); where 16 is however much memory you want to allocate in megabytes
  4. awesome! works great! any chance at getting something similar for json?
  5. Hermmm, okay. I'm doing this on a work server where we apparently have php ver. 4.3.2 so i can't use simplexml anything else I could try?
  6. Cool, thank you. I think this will work.
  7. OK guys, I've been working with PHP for some time now but I have very little experience with XML related code. I have access to the Pownce API which returns an XML document for the specified query and I'd like to convert that into a multidimensional array following the structure of the XML. Not sure if there is something already is PHP to do this or what. I played around a little with xml_parse but it wasn't digging into each node for subnodes and returning the whole shebang as I'd like. Example XML: <note> <id>a number</id> <permalink>a url</permalink> <type>message</type> <body>text</body> <timestamp>1193827966</timestamp> <seconds_since>2395</seconds_since> <display_since>19 min ago</display_since> <num_recipients>19</num_recipients> <stars>0.0</stars> <is_public>1</is_public> <sender> <username>someuser</username> <permalink>a url</permalink> <first_name>someuser's name</first_name> <short_name>someuser's name</short_name> <is_pro>0</is_pro> <profile_photo_urls> <tiny_photo_url>a url</tiny_photo_url> <small_photo_url>a url</small_photo_url> </profile_photo_urls> <blurb>some text</blurb> <location>some text</location> <country>some text</country> <gender>some gender</gender> </sender> <recipients> <user> <username>someuser</username> <permalink>a url</permalink> <first_name>someuser's name</first_name> <short_name>someuser's name</short_name> <is_pro>0</is_pro> <profile_photo_urls> <tiny_photo_url>a url</tiny_photo_url> <small_photo_url>a url</small_photo_url> </profile_photo_urls> <blurb>some text</blurb> <location>some text</location> <country>some text</country> <gender>some gender</gender> </user> </recipients> </note> <note> <id>a number</id> <permalink>a url</permalink> <type>message</type> <body>some text</body> <timestamp>1193827966</timestamp> <seconds_since>2395</seconds_since> <display_since>19 min ago</display_since> <num_recipients>19</num_recipients> <stars>0.0</stars> <is_public>1</is_public> <sender> <username>someuser</username> <permalink>a url</permalink> <first_name>someuser's name</first_name> <short_name>someuser's name</short_name> <is_pro>0</is_pro> <profile_photo_urls> <tiny_photo_url>a url</tiny_photo_url> <small_photo_url>a url</small_photo_url> </profile_photo_urls> <blurb>some text</blurb> <location>some text</location> <country>some text</country> <gender>some gender</gender> </sender> <recipients> <user> <username>someuser</username> <permalink>a url</permalink> <first_name>someuser's name</first_name> <short_name>someuser's name</short_name> <is_pro>0</is_pro> <profile_photo_urls> <tiny_photo_url>a url</tiny_photo_url> <small_photo_url>a url</small_photo_url> </profile_photo_urls> <blurb>some text</blurb> <location>some text</location> <country>some text</country> <gender>some gender</gender> </user> </recipients> </note> Would like this to return a multidimensional array follow same structure such as... [Note] =>array([id] => a number, etc.. [sender] => array([username] => someuser, etc... [profile_photo_urls] => array([tiny_photo_url] => a url, etc..))), [Note] =>array([id] => a number, etc.. [sender] => array([username] => someuser, etc... [profile_photo_urls] => array([tiny_photo_url] => a url, etc..))) Hope this is clear. Like I said, little XML experience so there could be something blatantly obvious that I've never seen. I just don't wanna have to write a verbose datamining script if I don't have to... Thanks!
  8. it only works on the first phot because that's the only one specificed to move to your target folder, found here in your code... if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) the code you have now is rather vulerable to mysql injection among other things, because you have no sort of filters for your photos and data input. but i'm too tired to go into that. try the code below. if it doesn't work, just copy the if else statement above (the WHOLE thing, including the else, "sorry...problem", and closing brace. and just change 'photo' to 'photo2', etc.. <?php //This is the directory where images will be saved $target = "../images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $suburb=$_POST['suburb']; $price=$_POST['price']; $content=$_POST['content']; $photo2=$_FILES['photo2']['name']; $photo3=$_FILES['photo3']['name']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("localhost", "root", "**********") or die(mysql_error()) ; mysql_select_db("gcproperty") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `employees` VALUES ('$name', '$suburb', '$price', '$content', '$pic', '$photo2', '$photo3')") ; //Writes the photo to the server foreach($_FILES as $val){ if(!move_uploaded_file($_FILES[$val]['tmp_name'], $target)){ $error = yes; } } if($error){ //Tells you if its all ok print "<meta http-equiv=\"refresh\" content=\"0;URL=property_added_successfully.php\">"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
  9. depends on what data users are searching. and a lot of ther things. maybe you could provide more information as to what data, database type, etc.
  10. must be a client related issue, hence not a php problem. probably a javascript error.
  11. define variable as global in the function or return variable value for function
  12. use mod_rewrite in .htaccess file
  13. this can be done many ways depending on your application and preference, here are 2 ideas. the first generates 2 global variables $manned, and $unmanned set to their respective values after calling the function. the second echos the numbers. the third returns an array containing "manned" and "unmanned" and their respective integers. this should give you some ideas. function farmers_calculate($farms, $farmers){ global $unmanned, $manned; $unmanned = $farms - $farmers; $manned = $farms - $unmanned; } farmers_calculate(10,; echo "$unmanned<br>"; echo "$manned<br>"; function farmers_calculate($farms, $farmers){ $unmanned = $farms - $farmers; $manned = $farms - $unmanned; echo "There are $manned manned farm(s) and $unmanned unmanned farm(s)"; } farmers_calculate(10,; function farmers_calculate($farms, $farmers){ $numbers['unmanned'] = $farms - $farmers; $numbers['manned'] = $farms - $numbers['unmanned']; return $numbers; } $numbers = farmers_calculate(10,;
  14. as i understand it, the reason you can't call the variable as you are doing is because it isn't defined until the object is instantiated and the constructor is called. if the static variable definition was outside the constructor, it would work. assuming correct syntax.
  15. try this class Dog { function Dog() { $this->myString = 'Seriously totally awesome'; } } $dog = new Dog(); echo $dog->myString;
  16. please elaborate and provide code to receive better response. off the top of my head, using joins might be what you're looking for. need more info...
  17. this uses checkdate, based on how you date is formatted, change the parameters accordingly checkdate(month, day, year) using your date schema, YEAR-MONTH-DAY is checkdate($date_parts[1], $date_parts[2], $date_parts[0]) function check_valid_date($date){ $date = trim($date); $date_parts = explode("-", $date); if( checkdate($date_parts[1], $date_parts[2], $date_parts[0]) ){ return 0; } return 1; }
  18. hey fellas, on my site michigandoctors.net, both of the search tools for find a doctor and find a hospital are screwing up in IE. the results don't show on the page although the results are in the source code. firefox displays results just fine. I can't recall making any changes recently but this is just killing me. any ideas? http://michigandoctors.net/?page=mods/doctor/search.php&city_search= lists results in firefox, none in ie thanks in advance EDIT: NVM, figured it out. damn i'm stupid sometimes....
  19. take me with you! fishing on the boat rocks. BTW, I'm in Michigan so you'll need to book me a round trip flight plus expenses
  20. I'm about to start work on a new project. Unfortunately I can't give out the details just yet but I am deciding on whether or not I should implement a framework. I have very little experience with frameworks and if I did use one, it would need a shallow learning curve. The project will involves lots of database queries and transactions so whatever I go with, I need to be able to apply lots of complex queries and such with ease. It doesn't need to be very extensive or have a big library. Preferably, I'd like an MVC framework so long as it's capable of rendering various data models from the DB without a whole lot of custom development. As I said, I'm a novice to frameworks and classes in general so the easier, the better. Once I get it running, I'll be posting here for contributors to provide a small amount of engaging volunteer work with the benefit of free promotion and resume-building experience and what have you. Any suggestions are welcome. Thanks for your time guys.
  21. should work, but use sessions, cookies can be disabled by the client
  22. $_SERVER['self'] doesnt exist use $_SERVER['PHP_SELF'], such superglobals were introduced in 4.1.0
  23. He should be castrated before he contributes to the gene pool and makes it remarkably stupider.
×
×
  • 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.