Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. Hi Andy-H, I did try pulling it from the global \Proem but it shouldn't need to and that doesn't work either. One thing (and probably the most important thing) I forgot to mention is that if I remove the ChainTest from the test suite all tests pass. So the issue isn't in Proem.php alone, it is only introduced when the ChainTest is also run.
  2. I have here what I would refer to as doozy. I'm not sure anyone is going to be able to help as there is allot involved. The issue could be in a number of locations, I am using PHPUnit as a test suite (and this is how I have found the issue) and PHP5.4rc5. The problem could be in either, or it could be in my code. I am also using a cascading filesystem (explained here) and while I'm confident this isn't the issue. It has the potential to be involved I guess. If you need to see how this is implemented it is see here: https://github.com/proem/proem/blob/develop/lib/Proem/Api/Autoloader.php#L108 I have narrowed the problem down to two classes: https://github.com/proem/proem/blob/develop/lib/Proem/Api/Chain.php & https://github.com/proem/proem/blob/develop/lib/Proem/Api/Proem.php The tests that test these classes are: https://github.com/proem/proem/blob/develop/tests/lib/Proem/Tests/ChainTest.php & https://github.com/proem/proem/blob/develop/tests/lib/Proem/Tests/ProemTest.php As the code stands right now, everything is fine and all tests pass. However, I am about to start some more work on the Proem\Api\Proem class and it needs access to the Proem\Api\Chain class. To do this, I add the line "use Proem\Chain;", the code becomes: <?php /** * @namespace Proem\Api */ namespace Proem\Api; use Proem\Chain; /** * Proem\Api\Proem * * The Proem boostrap wrapper (eventually) */ class Proem { const VERSION = '0.1.0'; } As soon as I do this the tests fail with: If I alias the namespace ( "use Proem\Chain as C;" ) the tests pass again. The issue is I shouldn't have to use an alias here. from the manual: Writing this post I have come to realise that the issue is likely that both the Chain class and the Proem class are in the same namespace yet I am trying to force the Chain class to be loaded from Proem\Chain instead of Proem\Api\Chain (this is part of the cascading filesystem setup). Anyway, if anyone has some ideas I would be grateful if you could take a look. Otherwise, it looks like I might need to do some re-shuffling. Iv'e created a ticket for this bug if anyone wan't to chip in. See here
  3. SELECT news.post_id, news.title FROM news WHERE Blog_Type = 'Food' AND record != 1 ORDER BY news.post_id DESC LIMIT 6
  4. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=351877.0
  5. You'll need to wrap both function calls in another function and call that. Better stil, you should be using unobtrusive JavaScript so that your events aren't mixed in with your markup.
  6. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=351832.0
  7. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351844.0
  8. Why are you opening multiple connections? A single connection would be better, but 14 queries is nothing.
  9. Yeah there is a limit, not exactly sure what it is though. Maybe 10 - 15 posts.
  10. Is this data coming form a database or something or are these links actually within a file?
  11. And where exactly are you stuck? Code would be helpful. The general idea would be something like: $out = array(); while ($row = $result->fetch_assoc()) { $out[] = $row; } echo json_encode($out); Obviously you would need to format the $out array into whatever format you need though.
  12. There is nothing in that rule that says your urls need to contain .php anywhere.
  13. What is with all the backslashes? That is not at all valid JavaScript.
  14. Someone sounds pretty excited about something Welcome to the boards.
  15. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351799.0
  16. Java is not JavaScript. You have also posted your code in the manual [m][/m] tags making it unreadable.
  17. While your problem is with your query you have a logic issue here. if (!$result=) { echo "Could not successfully run query ($result) from database" . mysql_error($con); } If $result is false you echo an error message. this is good, however, you never stop your code from going into the next part: if (mysql_num_rows($result) == 0) If $result is false, you will always get an error here because (as I have already explained) mysql_num_rows expects a result resource. Nothing else can be passed to it.
  18. Or better still, handle your errors properly. An example: if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { // $result is now good to use } else { // no results found } } else { trigger_error(mysql_error()); }
  19. Firstly, I haven't looked at your code because I won't download code. Anyway, your error is very common and is caused by passing the results of a call to mysql_query() straight into mysql_num_rows() without first checking to see that your query has succeeded. mysql_num_rows() expects a result resource, while mysql_query() will return a result resource on success or the boolean false on failure. For some reason, your query is failing. What does mysql_error have to say?
  20. Yeah SwiftMailer is the component that Symfony2 uses. I was going to suggest using Zend's Mail components but it would have been more of a hassle to pull out of the framework.
  21. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=351796.0
  22. You want to GROUP BY, not DISTINCT.
  23. It shouldn't. How exactly have you set it up?
  24. nl2br already coverts newlines to <br /> tags. You shouldn't do this on the way into the database however, only on the way out.
×
×
  • 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.