Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. 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
  2. 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.
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. use SimpleXML instead of the DOM. -Dan
  9. 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
  10. Or do like you were told on devshed and remove this loop entirely.
  11. 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
  12. 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
  13. One of those things that's funny until it happens to you.
  14. 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
  15. 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.
  16. 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
  17. You're not properly quoting your array indexes. You also added that fancy new function and you aren't using it. -Dan
  18. Eclipse PDT is free.
  19. 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
  20. 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
  21. 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
  22. 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
  23. Specify which columns of the target table you're trying to insert into: INSERT INTO table1 (table1ColumnName1, table1ColumnName2) VALUES (SELECT col1, col2 FROM table2) -Dan
  24. You have a comma at the end of your SELECT list.
×
×
  • 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.