Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. Turn error_reporting on, and print mysql_error. mysql_query returns false when there is an error. You are using "false" like a database result object, when clearly it isn't. You're also using the word "term" instead of the variable $term, and you're not running $term through mysql_real_escape_string. -Dan
  2. @jim: Why should we have to explain the reason behind linking someone to the manual? Don't you think linking someone to the manual implies "You should read this page, I am not linking to it because I'm practicing my linking skills"? @RON: You have been given the solution, twice now. Debug this on your own, or be more clear as to what "not working" means. Is the time on the server right? Do you know what timezone you're in? Have you tried the other two solutions you've been presented with?
  3. Your structure is wrong (probably). What you really want is a table for Users (userid, username, etc) and atable for Movies (movieid, movieName, etc). Then you want a cross-reference table that has movieId and userId. This way, you're not duplicating the movie titles. If 100 people like The Matrix, using your method you'd have 100 instances of the title "The Matrix" in your table. Using mine, you'd only have one (plus 100 cross-reference rows). Now, if you're asking "how do I go about making a dynamic website such as this," there are plenty of PHP tutorials out there. -Dan
  4. Test it yourself: if it takes 30 seconds without it, use it. PHP will close the connections automatically, but if you're really worried, use mysqli_close.
  5. I didn't realizing linking him to the manual page describing the exact functionality he needs (along with pages upon pages of examples) was a "dungeon master style riddle." Next time someone asks me how to put a nail into a board, I'll give a dissertation on the use of a hammer. Click the links to the manual pages, read the manual pages, learn something. The last step is important. As for pointing out the syntax error, he received help and responded to it by simply asking for help. I gave him additional, nonspecific help to respond to his additional nonspecific request for help. The DateTime class and its related functions are PHP 5.2+ only, and a lot of the timezone functionality is 5.3+. Since all we had were 3 malformed lines of PHP, assuming he was on PHP 5.3 was too big of a jump for Requinix and me. -Dan
  6. Look at your post. See the problem? Get an editor like EclipsePDT that highlights PHP for you, you'll see string errors like this more easily. -Dan
  7. Do you mean aside from the help you've already gotten? Your code has a syntax error in it, in addition to being logically incorrect. -Dan
  8. Use the string parsing functions to actually break it up by hand rather than trying a pre-build solution. Preg_match_all can handle a well-formed RSS feed like this. Or you could use strpos and substr to manually pull each tag into a variable. It will be tedious, but if the XML is so weird that both XML parsing functions choke on it, it might be your only way. -Dan
  9. that RSS feed isn't properly encoded, so simplexml_load_file is throwing a UTF-8 encoding error. The errors I'm getting on that feed are either encoding related or CDATA related. It seems your target feed is poorly formed. Parse it by hand, or contact the publisher. The apostrophe in "Genentech's" is not actually an apostrophe, that seems to be the issue. I don't know why simplexml is failing on a CDATA field, but it is. -Dan
  10. use SimpleXML instead of the DOM. -Dan
  11. OOP has nothing to do with your question, you seem to be getting caught up in your own design pattern. Take a step back and think about it: You have an object representing the article. It has changed. You want to record the changes in the database. What do you do? Add two columns to your table, for "edit date" and for "visible." When your system would otherwise do an UPDATE, change that so it simply sets the old record to "not visible" and INSERTS a new record with NOW() as the edit date. Now, you can simply display the visible record, and keep all the invisible ones as the edit history. -Dan
  12. Or do like you were told on devshed and remove this loop entirely.
  13. Per the PHP manual, loadXML()'s first argument is the XML, not a URL. You want to eliminate that line and just use the load() function. -Dan
  14. There's no "rule" for your display here. When is the key printed and when is it not? It seems that you can't use a recursive algorithm here because you can't tell which rule to follow. Nested loops may be your best bet. -Dan
  15. One of those things that's funny until it happens to you.
  16. Debugging tips: 1) Turn on error reporting. You had & instead of $, error reporting would have told you this. 2) Print your variables. This means printing $sql and looking at it. See where the problem is. -Dan
  17. That standard app has a known issue (nearly 3 years old at this point) where if you're tying a text to person A, and you get a text from person B when you're typing, the subsequent 'send' will go to personB instead. My friend discovered this when he accidentally "sexted" his 11 year old son instead of his girlfriend.
  18. Email, I don't know, but chompsms wakes the screen if you get a text, and it's 10x better than the stock text app. -Dan
  19. You're not properly quoting your array indexes. You also added that fancy new function and you aren't using it. -Dan
  20. Eclipse PDT is free.
  21. It seems like this will work: <?php $nav = array( "title1" => "url1", "title2" => array( "sub-page1" => "url1", "sub-page2" => "url2" ), "title3" => array( "sub-page1" => "url1", "sub-page2" => "url2" ), "title4" => array( "sub-title1" => array( "sub-sub-page1" => "url1", "sub-sub-page2" => "url2", ), "sub-title2" => array( "sub-sub-page1" => "url1", "sub-sub-page2" => "url2", ) ), "title5" => "url1", "title6" => "url1" ); function print_nav ( $key, $value ) { if ( is_array($value) ) { echo "<ul>\n<li>{$value}"; foreach ( $value as $innerKey => $innerValue ) { print_nav($innerKey, $innerValue); } echo "</li>\n</ul>"; } else { echo "<ul>\n<li>{$value}</li></ul>"; } } However, your example is confusing and doesn't include all the items under title4. -Dan
  22. Basically your problem is that you have TWO entries for the same address, so when you do your SELECT then you get multiple entries for the same ID, and you cannot enter multiple entries for the same ID into your target table because you have a primary key set up. So the solution is to replace SELECT with SELECT DISTINCT, or SELECT DISTINCT(needleji_xcart.xcart_address_book.id). That should clear out the duplicates. -Dan
  23. Look at your code now that it's highlighted. The error is quite literally as plain as day. I recommend downloading Eclipse with the PHP editing plugin, it will highlight your code for you. Also, the curl braces for your foreach statement aren't required, but they're recommended. -Dan
  24. Your SELECT query is producing multiple matches. You will have to SELECT DISTINCT, or remove the keys from your target table and delete the duplicates by hand. -Dan
×
×
  • 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.