Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. So for your first question, to determine whether you have an array, there is isset() and is_array(). In your case I don't really think you need that code since you're planning to pass in the array as a parameter. I believe what you're looking for is pass by reference. Using your original example: function createCatTree($thisParentCatID=0, $depth=0, &$arr) { When declared in this manner, you can change $arr inside the function, and you will be changing the array that you pass.
  2. The first form is the most standard across different RDBMS.
  3. It was just shorthand for me pointing out that the datatype and name should match the name of the primary key in each of the associated tables. There are other benefits to defining a true foreign key constraint, but with mysql many people use the default myisam engine which has no support for constraints or foreign keys. Often people will do this: mytable id (primary key) anothertable ----------------- id mytable_id (foreign key to mytable) So the actual name doesn't have to be the same in each table. Whatever name you use for it, the important thing is that the datatype of the column should be exactly the same. Since you will also be joining on that table, it's important to have a non-unique index on it as well.
  4. Doddsey, This thread seems to be turning into a journal of your development activities. That is not the purpose of this forum, so I'm going to go ahead and lock this thread. Good luck with your project, and of course if you have questions you are more than welcome to continue to pose them in the appropriate forums.
  5. Assuming you have two tables, photo and user, and each has an id (photo_id, user_id) as the primary key, you put a table between the two. Let's assume you call this table "photorating" photorating -------------- photorating_id (primary key, autoincrement) users_id (fk to users table) photo_id (fk to photo table) rating tinyint created_on timestamp You stick a row into this table for a rating. Add a unique index on user_id, photo_id and it becomes impossible for a user to have more than one rating row in the table. You have a variety of options for how you want to deal with the rating ... you can look up the rating, or simply try the update and handle the failure/exception that will occur due to the unique index.
  6. Nice clean site. I think it will be successful.
  7. I don't know how old the book is that you are trying to use, but the bad news is that the php facebook api has changed. That method is no longer in the api, which is why you are getting the error. The new one is here: https://github.com/facebook/php-sdk/
  8. You just add additional LEFT JOIN statements. SELECT teams.*, roles.* FROM teams LEFT JOIN users_teams ON (teams.team_id=users_teams.team_id) LEFT JOIN roles ON (roles.role_id = users_teams.role_id) WHERE users_teams.user_id = $userid
  9. TWIW you can use keywords all you want, just so long as you put `...` around the keyword. So in your example, this would have worked: UPDATE pm SET `read` = '1' WHERE id = '15'
  10. A css ID name can not start with a number. It has to be a letter from a-z first.
  11. The software patent process is a complete joke. For a website -- copyright it is about the best you can do, although a lot of people are going for alternative licenses like CC these days. There's also a lot of action around people trademarking (Twitter") their brand names and logos, but that's a seperate process. You have to file for a trademark, whereas you can simply add the copyright symbol and statement to your site.
  12. I really should try and figure out a way to go next year. Also haven't been to Austin, so it would kill 2 birds.
  13. You'll have to provide more information. Your question is too vague.
  14. This is an important line: It's expecting that the swf is in the same directory as the one where the master script is executing. You might have to adjust that.
  15. The important part of that is simply the object tag. It does not have to be inside a table.. you can stick an object inside a , so just cut and paste everything from into your new file. You can drop out of php inside your php file of course. // need pure html block ?> // do more php if needed ?>
  16. From a database point of view you would want a table that is related to the video table. Let's assume that the video table has a video_id as the primary key. I'll also assume your user table has a primary key of user_id. This new table called videoview could be as simple as: videoview_id int (PK, auto increment) user_id video_id viewed_at timestamp You simply need to enter a row when a user views a video. Then you code up your query of random videos to include "...WHERE NOT IN (SELECT video_id FROM videoview WHERE user_id = $user_id)"
  17. I envy you being at sxsw. While you're enjoying the BBQ and beer please have an extra couple helpings in my honor, as I wipe kids asses and clean up dog puke. Also CV, you know that he only has eyes for you.
  18. I must be from a different part of the hood. With that said, I did point out an error in your code. If you post the current version maybe we can help you out. I don't know what you removed, but you should have left in the while loop and just removed the inner do... while() loop.
  19. No worries, I look forward to listening to em.
  20. HTML does have a special tag for this type of situaion: --- .
  21. Yes godaddy supports that, as well as mod rewrite rules which you could use for your existing pages. A common strategy for dynamic websites is to make dynamically generated pages "appear" to be static html files using mod_rewrite. It looks in this case like just remapping .html to be parsed as php is simpler but for completeness sake, I thought I'd mention the alternative. For example, it's not an infrequent occurence that people completely rewrite a site and restructure it, however, they have a lot of google links to what would be obsolete urls, which they don't want to lose. So they put in mod rewrite rules for these links that redirect to the new url where the content has been moved to.
  22. Yes exactly. I think this speaks to your example of people that spend lots of time on a site and have no visitors. That does indeed happen frequently, and they get frustrated, yet never realize the problem is that they never marketed or advertised it. Of course there is no panacea, and how you advertise the site depends greatly on the type of site it is. For example, if you are selling something, you need to buy into eyeballs just for that site. If you have a site that is a service, then you want to get the attention of people who are your target market. Then there's the example of a site like SBNation that did a deal with Yahoo to be a sort of affiliate blog network. SBNation has some other strategies that you can read about here: http://en.wikipedia.org/wiki/SB_Nation but having witnessed first hand how it blew up to 12m visitors and 100m page views in a year, was the deal they did with Yahoo to have postings from all their blogs appear in boxes for Yahoo's related sports content. Even though SBNation is a completely unrelated entity that is paying yahoo for all the traffic they are generating for SBNation, to the yahoo visitor it appears that SBNation is an extension of Yahoo.
  23. Cal, I understand where you're coming from. It's a fine line between talking enough to keep the interview on point and flowing, and stealing attention away from the subject. However on the flip side, if there's not interchange between you and your guests, then you have to ask yourself what value you are providing, when it could just as easily be the guest giving a canned presentation or speech. My suggestion on this is when you're listening to them, just ask yourself if the "new PHP developer" would understand what the guest is talking about. When he started talking about Dependency Injection being a major design goal, I think that's a perfect example, where it would have been good to challenge him on that question. "Ok, so for people who arent't familiar with DI, can you give an example of what it is, and talk about why you feel this is such an important feature of the framework?" Otherwise it's a lot of --- well of course we use "strategy x".... "yeah no need to talk about that it's obvious"... I think a litttle bit more of that sort of discussion, and being able to react to the guest would make what is already a solid podcast, even better. I've listened to FOSS weekly on and off over the years, and it's got similar challenges, and can be really hit and miss. Randall Schwartz is also a programmer, and most of the time that's helplful because when it's a development project he has a good feel for the buzz words, and attempts to draw the subjects out by asking questions that come up in the context of the interview. So, while it's partly about preparation, it's also partly about listening and reacting.
  24. Cal, I'm listening to an episode right now and this is already one of the best ones I've heard. In general the problems with a lot of them is that they have poor production values, and hosts who don't know how to interview people, don't know enough about the subject matter to actually figure out good questions, and in general just aren't really interesting to listen to. One thing I liked about this one is that you brought in some human elements to it -- asking Paul Jones about what he looks for in an employer, lead to some good human level discussion. Truthfully, in the rest of the interview, I didn't get a real feel for your level of expertise. You may be an expert, but after he went on a long description of his design for Solar, and talked about DI as an example, you pretty much just said: "um hum, ok" now about communities. I guess for me, this is sort of the same thing I would say about Terry Gross on Fresh Air or Charlie Rose. They are good intervieweres because they prepare questions, and do research and have a good idea where they want to take the interview.
×
×
  • 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.