Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. Here, something like (not tested)..... <?php function getPN($path) { if ($dh = opendir($path)) { while(false !== ($file = readdir($dh))) { if (is_dir("$path/$file")) { if (substr($file, -3) == '.pn') { return "$path/$file"; } else { getPN("$path/$file"); } } } } } ?> that should return the path to your *.pn directory.
  2. You should look in the manual before wasting your time asking such simple questions. http://dev.mysql.com/doc/refman/5.1/en/stored-routines.html
  3. Even if there was (which there isn't) you would still need to query the database to find out (which is actually what you are doing).
  4. You'll need to recurse through the directory structure until you find what your after. Not too difficult.
  5. How are you accessing this script though? Via HTTP?
  6. It's pretty rare you'll get help with third party code, especially when you don't seem to have made any attempts to debug the issue yourself.
  7. You might find this.... http://www.subbu.org/blog/2006/04/dissecting-ajax-server-push interesting.
  8. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=321575.0
  9. Kinda sounds like your fishing around for what is called the MVC pattern. This post..... http://www.phpfreaks.com/forums/application-design/fully-understanding-mvc-concept/msg729041/#msg729041 might help.
  10. A few things. Firstly, you passing the data parameter a variable called data, this is undefined and you don't need it. Secondly, your telling the $.ajax() function that it is to receive the dataType of json from this request, then you return it plain text. You should stick with the json dataType, but fix your php accordingly. (this will make things more flexible in the long run). Lastly, jQuery provides mechanisms that mean you don't need to mix Javscript in with your markup, use them. So, with those things in mind, your code should not look like. <?php echo json_encode(array('foo' => 'Here i am')); ?> <html> <head></head> <body> <form> <input type="button" id="clicker" value="Click me!" /> </form> <div id="here"></div> </body> <script src="jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('#clicker).click(function() { $.ajax({ type: "POST", url: "variable.php", dataType: "json", cache: false, success: function(json) { $('#here').html(json.foo); } }); }); }); </script> </html>
  11. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=321568.0
  12. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321572.0
  13. You already have the data, why do you need an array? Anyway, try... foreach( $keywords->responseData->keywords as $keyword) { echo $keyword->content; }
  14. Where not here to write code for people, where are you stuck exactly?
  15. Object properties are access via ->, this is all covered here. If your still stuck, can you please paste the source of what the call to print_r() produces so it is at least readable?
  16. You'll likely want to form some markup and use that. eg var tmp = ''; for (var question in answers) { tmp += '<div>'; tmp += ' <span class="question'> + question + '</span>'; tmp += ' <span class="answer'> + answer[question] + '</span>'; tmp += '</div>'; } document.getElementById('answers').innerHTML = tmp; I'll kill two birds here. yes, console.log() is used for debugging via firebug. It's also a good thing to use in examples posted on forums IMO, because people will be outputting things in different way, I was just pointing out how you access data within json objects. As for how you can see your json data? Take look at it in console.log().
  17. It's common practice in PHP applications. Or web applications in general really. Unless of course that is your used to working in Windows and IIS.
  18. That basically says, send all request for /blog to post.php and pass anything after it (eg; /blog/foo, would be foo) to the querystring variable post. So, within post.php 'foo' would show up within $_GET['post'].
  19. Just to reiterate. Lets say your var answers, is a json object that looks like..... var answers = {"q1": "Pigs that fly", "q2": "Because", "q3": "Why not"}; You can access easily them via.... console.log(answers.q1); console.log(answers.q2); console.log(answers.q3); If you want to loop through them, use.... for (var answer in answers) { console.log(answers[answer]); }
  20. You don't want to convert json to a javascript array. it is already a simple javascript object. Given this json.... var json = {"id":12,"name":"foo"} You can access it easily using.... var json = {"id":12,"name":"foo"}; console.log(json.id);
  21. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=321546.0
  22. You should take a look at http://jqueryui.com/demos/dialog/
×
×
  • 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.