Jump to content

xionhack

Members
  • Posts

    116
  • Joined

  • Last visited

Everything posted by xionhack

  1. Hello. In my business logic, I have a user, a company (users can be part of the company) and products. A product can be owned by a user or by a company, the company can assign it to a user later, but it would still be owned by the company (in case the company fires the user). My thought is to have the user table, the company table and the product table. I'm thinking about having a product_owner table, where I would have product_id, user_id, company_id, agent_assigned. If the product is owned by a user then only product_id and user_id will be filled. If it's owned by a company, then product_id, company_id and agent_assigned would be filled. Is this the best way to do it? It doesn't seem good to me.
  2. Hi! thanks for your reply. Is the saturdays in this month. I'll try to work with what u told me! Thanks!
  3. Hello! I want to be able to make a code that tells me how many saturdays have passed till today. I've tried a couple of things but nothing. Any help?! Thanks!
  4. Hello. I have a database with my blog addresses, I want to be able to populate a list of only the blogs that end with .blogspot.com. How can I do that? Thank you!
  5. Hello. I have an object like this: object->object_id object->object_name object->object_number I have an array with many instances of the object, with different values. I want to sort that array to put first the object that the value of object->object_number is higher, and then descending. Please let me know if its not clear! thank you!
  6. Thank you, that makes sense!
  7. Hello. I want to create some variables dynamically. I have this so far: for($i = 1; $i <= 4 ; $i++){ $a = 'member' . $i; $$a = array(); } Does that give me this 4 arrays?: $member1, $member2, $member3 and $member4? Of course I want some process inside of the loop, but that would depend on the variables. Would that work? thanks!
  8. Thank you! that works!
  9. Hi, I was trying this code, but it only works for this month. Its not working for the next months.
  10. Hello. I have an organization where the members are grouped in teams, which have a team leader, and big groups, which have a group leader. It goes like this, one member can only have one team, meaning one team leader. One team (team leader) takes care of 1 or more than 1 members. 1 team can have 1 or 2 team helpers. Each team is part of 1 group. Each group have a group leader. The group leader is in charge of 1 or more than 1 group leaders. The way i have the tables set up is as follows: Member Table : member_id, name, group_id, team_id, helper_id Team Table: team_id, team_leader, team_helper, team_helper2 Groups Table: group_id, group_leader I dont know if thats the best way to do it, I actually feel its not even close. Does anybody has any input? Thanks!
  11. Hello. I want to generate the initial of the day of all the days of a chosen month. Meaning, if I choose this month it will give me: TFSSMTWTFSSMTWTFSSMTWTFSSMTWTF Is that clear? Can anybody help me? thanks!
  12. Hi! thank you! it works well! except for something. It doesnt want to take some links that are long like : http://www.facebook.com/album.php?aid=8228&id=680439301#!/pages/test/test-test/162482691457?v=wall Also, I dont want to get the mailto: tags but just leave them as mailto: . I was trying the following regular expression and code but its not working either, its not taking the attribute tags nor the mailto, I find regex so complicated!: $pattern = '%<a (??!href)[^>])*+href\s*+=\s*+"([^"]+)"[^>]*+>([^<]*+(??!</a>)<[^<]*+)*+)</a>%';
  13. Hello. I have a questions that I think its pretty much about regular expresions. I have this code: function create_link($matches) { // link_id should be an auto-increment field $insert = mysql_query(sprintf("INSERT INTO links ( link_url ) VALUES ( '%s' )", $matches[1])); return '<a href="' . mysql_insert_id() .'">'. $matches[2] .'</a>'; } // File name, could be a url $file = 'file.html'; if (file_exists($file)) { $content = file_get_contents($file); // Regex replace string $pattern = '/<a href="([^"]+)">([^<]+)<\/a>/s'; $content = preg_replace_callback($pattern, 'create_link', $content); echo $content; } What that does, is that it checks for all the links in a page, saves the links in a database and then swap the link address with the id of that link in the database. The problem that i have is that the code works when the link is just "<a href="" ></a>" but if the <a> tag has an attribute, then it wont work. i.e <a href="" id=""></a> OR <a id="" title="" href=""></a>
  14. anybody can help me with that regular expression?!
  15. Hi, thank you so much, it works like a charm! the only problem that it gives me is that if for example, instead of <a href=...> they write <a id=... href=...> it is not swaping them, nor when they do <a href=... title=...> , I tried fixing the regular expresion but it was just breaking the code. Any suggestions? thanks
  16. Hello. I have a question. I am making an application that shows if some "members" have done some "studies". There are 50 set studies. This is the way I have it set up: 3 Tables ---> Member: member_id, member_name Studies: study_id, study_name member_studies: member_id, study_id, teacher, comments, date In the "member" table I actually have about 50 other fields, I just didnt put them because they were not needed. My concern is, because I have more than 1000 members, If I want to know how many people did for example the "study 1" then, It will do a search through all the ones that have the study_id = 1, then check which name is to the "member_id" and which study_name goes for the "study_id". My problem is that I think that would take a long time. Is it better if I just put those fields for each lesson in the "members" table (the problem with that one, is that I will have more than 200 fields). I dont know If everything is clear, but please let me know if its not, thank you.
  17. No, just store the credentials. Its in two parts. One page to select which credentials the employee needs, and the other page is to write the credentials that were chosen in the first page. Different people will use the different pages.
  18. No, its not really set permissions. Lets say, I have to set up accounts for hotmail, gmail, yahoo for everybody. Then I just want to store them in the database. One person would say "this employee needs hotmail" the other person will set up the hotmail account and store the credentials there. But I want that if the person to be set up only needs hotmail, that the person that is setting him up only has the input boxes for the hotmail credentials.
  19. Hello. I have a little coding dilema. I am making an application, but i think i better explain by an example. I have to make different logins for people at my job. Lets say "login 1", "login 2", "login 3", "login 4" and "login 5". Not everybody needs those logins, some people only need "login 1" or "login 2" and "login 3". There is one person that says the name of the employee and which logins he needs. Another person sets up the logins. I have a form for the first person where he can write the name of the person and have 5 checkboxes for the different logins. The second person would get the name of the person and the id and password box for every login. The way I have it set up right now is that the table has the following: id employee_name needs_login1 login_1_id login_1_ps needs_login2 login_2_id login_2_ps needs_login3 login_3_id login_3_ps needs_login4 login_4_id login_4_ps needs_login5 login_5_id login_5_ps Meaning, if needs_login1 is equal to 1 then show the boxes for login_1_id and login_1_ps. It does that through a couple of if statements. I find my way very messy. What would be the best way to do this? let me know if you dont understand. Thank you.
  20. Hello. I have a project that is a little bit complicated for me. I want to give the source of an html site as a string, check that string and save all the links in "href" to a database, then replace those links with the id that the database would give. For example: <html> <body> Hello, my name is <a href="http://www.link1.com">Xion</a>, and I'm trying to program in <a id="link" href="http://www.php.net">PHP</a> </body> </html> What it would do is to save those two links in a database, into something like +------------------+------------------------------+ | Link_id | LINK | +------------------+------------------------------+ | 1 | http://www.link1.com | +------------------+------------------------------+ | 2 | http://www.php.net | +------------------+------------------------------+ And then swap the site with: <html> <body> Hello, my name is <a href="1">Xion</a>, and I'm trying to program in <a id="link" href="2">PHP</a> </body> </html> IM STUCK!!! Can anybody help me? Thanks!
  21. Nobody?!
  22. Hello. I have a form in my website where people will put their html code. What I want to do is to be able to take all the links in that html and swap them with something else. So that would be 2 processes, first get all the links and then swap them. For example If i submit: <html> Hello <br /> <a href="http://www.google.com" > Google</a> <a href="http://www.yahoo.com" > Yahoo</a> </html> That would become <html> Hello <br /> <a href="http://www.link_1" > Google</a> <a href="http://www.link_2" > Yahoo</a> </html>
  23. Hello. I have this array: [0] => Titles Object ( [id] => 1 [dep_access_id] => 1 [title] => Sales Administrator [access] => ) [1] => Titles Object ( [id] => 2 [dep_access_id] => 2 [title] => Sales Consultant [access] => ) [2] => Titles Object ( [id] => 3 [dep_access_id] => 3 [title] => Sales Receptionist [access] => ) [3] => Titles Object ( [id] => 4 [dep_access_id] => 4 [title] => Sales BDC [access] => ) [4] => Titles Object ( [id] => 5 [dep_access_id] => 5 [title] => Sales BDC Manager [access] => ) [5] => Titles Object ( [id] => 6 [dep_access_id] => 6 [title] => Service BDC [access] => ) [6] => Titles Object ( [id] => 7 [dep_access_id] => 7 [title] => Service BDC Manager [access] => ) [7] => Titles Object ( [id] => 8 [dep_access_id] => 8 [title] => Service Manager [access] => ) [8] => Titles Object ( [id] => 9 [dep_access_id] => 9 [title] => Service Driver [access] => ) [9] => Titles Object ( [id] => 10 [dep_access_id] => 10 [title] => Service Assistant Manager [access] => ) [10] => Titles Object ( [id] => 11 [dep_access_id] => 11 [title] => Parts Driver [access] => ) [11] => Titles Object ( [id] => 12 [dep_access_id] => 12 [title] => Parts Counterman [access] => ) [12] => Titles Object ( [id] => 13 [dep_access_id] => 13 [title] => Parts Manager [access] => ) [13] => Titles Object ( [id] => 14 [dep_access_id] => 14 [title] => P & S Director [access] => ) [14] => Titles Object ( [id] => 15 [dep_access_id] => 15 [title] => Shop Foreman [access] => ) [15] => Titles Object ( [id] => 16 [dep_access_id] => 16 [title] => Finance Manager [access] => ) [16] => Titles Object ( [id] => 17 [dep_access_id] => 17 [title] => Finance Biller [access] => ) I want to sort it by the [title] key. How can I do that? Thanks
  24. Thanks! how would u modify this and show all the saturdays and tuesdays of the month?! Thanks!
  25. thanks! i feel stupid!
×
×
  • 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.