Jump to content
Larry Ullman's Book Forums

Jonathon

Members
  • Posts

    1064
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Jonathon

  1. Glad you sorted it. Yes you're totally right, anyone can read books upon books about programming and follow it (more or less), but I personally find that I can't progress unless I try to put it into action on my own or use a combination of what I've read to try and provide a solution to whatever I'm trying to do. Most solutions I find, I know the code behind them, it's just i'd never have thought to do it myself, whcih I suppose is the battle. Best of luck with your project anyway
  2. if (preg_match('/skill_item\d{1,2}$/', $value) Here $value is equal to the value set in the form. So that validation will always fail. Because the value will be taken from this <option value="2"> ie the preg_match is checking to see if preg_match('/skill_item\d{1,2}$/' === 2 The $key will be skill_item4 so something more like this: $skills = array(); // empty array to store values of multiple skill_item questions foreach($_POST as $key => $value) { if (preg_match('/skill_item\d{1,2}$/', $key)) { // select element is skill_item field $value = (int) $value; // or further validation if you wish. $skills[$key] = $value; // will generate an array like Array ( [skill_item4] => 5 ) } else { echo 'Wrong field element'; } } It isn't perfect code but it may help you to see how it works
  3. If you got it working then that's great, I don't know what books you have, but the QuickPro is very good if you don't have it, it covers a lot of things.
  4. Currently $name is equal to a literal string. You can just use a regex if you want to. $data will never be created unless $name is equal to 'skillLevel%', which it won't be. Regex's are a bit more intensive on resources, perhaps you could use the substr to achieve confirmation that skillLevel is in the string. Thinking ahead, perhaps it may be best to name your fields skillLevel_1, skillLevel_2 then you could explode() it to return the 'skillLevel' part, which would allow you to continue the process and also you could know the number of the skillLevel. Does that make sense?
  5. Would a indexed array help you with a foreach loop being used to generate the option value and display areas?
  6. Incredibly constructive Edward, you should have said you had 7 JavaScript books!! Which brings me to my next point, if being as you have 7 JavaScript books, why do you need a cookbook on JQuery? (Rhetorical question) As you may have noticed I stopped replying some time ago to your private messages, this will translate over to the forum also.
  7. I would say that you can't/shouldn't try to use a javascript framework without being somewhat clued up on javascript. It's not a case of reinventing the wheel, although I understand why you say to just use jquery. But to use it well and if you want to be able to use it on multiple sites with multiple plugins, that the cookbook possibly won't cover. Then you try to get a good understanding on js. Especially if you want to start using things like ajax.
  8. Rob is correct. Mega useful, nothing worse than horrible source code.
  9. Hi Larry, Yes I did, after I wrote this post I looked up other exampLes and found that they weren't too disimilar to mine. We'll see, I'm redoing my personal Yii project, so it's no big deal if it's not quite right. Thank you
  10. I apologise for the crudeness of this example. I'm using the workbench on a personal project and I've plugged in all my data and allowed the workbench to generate the relationships, which is fine. but what is the difference between relationships that start -| |--------- and ones that start like -|-|---------- is one identifying and the other non-identifying? On a secondary note, I feel like most examples i've seen of your models Larry flow nicely in an almost clockwise manner. I'm finding that mine has 5 tables that all feed into a central table, this central table is the hub of the displayed information, but there is a fairly large proportion of the central table that is built up from P.Keys in the other tables. Does this mean that my design is poor at a guess? I realise that there isn't a great deal of information for you here, but I didn't want to bombard you with huge swathes of information.
  11. Yeah, this is say an id of one table that appears in other tables to reference data. I tried quite a few variations of the the Foreign key command, including yours, but sadly they didn't work :-( So it looks like manual updating of the models, which isn't too bad (I don't think, I know you cover it in your guides), so it would have been nice to get a good DB down and Yii just do it for me. Maybe in 2.0! Thanks Larry
  12. Yes I know that Edward, I was the one who suggested to you to use Yii http://www.larryullman.com/forums/index.php?/topic/942-what-frameworks-do-people-like-the-most/. I know how Yii works its DB relationships, I just wanted to know from Larry or a seasoned Yii intermediate/pro (Of which I don't think there are any here accept Larry) if it's possible to do what I'm trying to do.
  13. I don't have that book, I know you can edit them directly in the model, but if possible, I'd rather let Yii do the work by using comments.
  14. Hello! I have a foreign keys that are represented in multiple tables, is there a way to get Yii to recognise more than 1 foreign key comment when generating relationships. I've tried so far CONSTRAINT FOREIGN KEY (id) REFERENCES r_detail(created_by_user), mentions(user_id) Yii just seems to take the last table(column) as the relationship, regardless of what precedes it. Is it even possible what i'm trying to do? I don't know
  15. Most clients won't understand rhe difference and probably won't care. OOP is about re-usable code, so I would suggest that you don't make OO classes just for one project and then try to re-use them. I'd make a series of classes as a framework and then use them in projects if appropriate - then you could argue it is a service to the client as you've already done the hard work, all you're doing is passing details to the objects.
  16. I guess your code would help here. At a guess I'd say you're not hashing the original password and the stored hash
  17. I decided not to, because it's often described as MD5 encryption, so it's easy to see why people think it's an encrypted password.
  18. I think it depends on the level of security you really need. Md5 has already been cracked I believe so I'd rule that out. Sha1 is a good alternative to md5 though.
  19. I can't be sure from the description, but one reason can be using a closing php tag on included files.
×
×
  • Create New...