Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. I don't think it has an officially official name, but it is indeed an assignment operator for arrays. key => value $names = array('Firstname' => 'John', 'Lastname' => 'Doe'); You can also use it in foreach loops to make use of the keys and values foreach($array as $key => $val) { echo "key: $key val: $val <br />"; }
  2. If I could afford it I probably would keep mr stickaround over newbie but that's just because I'm not really seeking to be a millionaire. But then you know how it goes: the more money you make, the more you spend it. It's real easy for you to say that when you're not the boss, having to pay the bills and save money for company expansion. Not to mention potentially multiplying that by a dozen or 100 or thousands, depending on how big your company is and how many others are in that situation. Bottom line is the guy next door is gonna try to do what you do, only cheaper, and if you don't do something about it, mr stickaround isn't going to be sticking around anyways...and neither will you. So in order to compete, you have to find ways to reduce cost of business, and sometimes it just comes down to hiring the cheaper guy. Why do you think more and more corporations are outsourcing to poorer, more populated countries? It's because they will make it or do it cheaper. So the lesson here is that the real villain in all this is the consumer. Buyers don't really measure things by quality anymore. Or at best, it's 2nd fiddle to price and function. "It does the job better" is rarely considered anymore. Commercials have been feeding us that slogan for so long that we're slowly growing numb to it, from the toes on up. All we really care about now is that it simply "Does the job," and eventually all we'll really care about is that it just does something.
  3. Well thanks for letting us know, but seeing as how we didn't make SMF you should probably post this on their support forum.
  4. well i think he probably got replaced because the newbie probably cost a lot less. Tenure at a company does count for a good chunk of one's salary, esp. after being there for 15yrs.
  5. Time stamps are measured in seconds. So subtract one timestamp from the other and you have the difference in seconds. Then use basic math to figure out. 60s in a min, 60m in an hour, etc...
  6. Maybe they are looking for someone to port code over from one to another? Or maybe like usual the people who type up the job description don't really know wtf they are talking about so they just throw in as many big words as possible?
  7. Whoa Whoa Whoa hold up there. Wtf you talkin' about, you don't own me. You ain't puttin' jack sh!t on me.
  8. Hey wow I didn't know you could do that; learn somethin' new every day I was just gonna suggest eval()
  9. I don't know any others off the top of my head, and I'm sure you know how to google just as well as the next guy. You do have the option of making a request here and maybe someone will write one.
  10. Most of the old tutorials were lost due to circumstances that happened a while back. Even the few that did manage to survive are a bit mangled. I looked through them, and that one didn't survive.
  11. what about your img_box2 class? does it have some kind of fixed width or some other css attribute that would cause it to truncate, but not truncate by simply echoing it out, since it's not inside that class?
  12. Is it inside some kind of div or something that has some kind of fixed width?
  13. Well then you need to put your drop down loop inside your main loop that loops through employees if more than one is selected
  14. Well look at the code in the while loop: $selected = ($account_info['dept_id'] == $depts['dept_id'])? "SELECTED" : ""; // pass the dept_id as the value to change, and use the dept_name for readability echo "<option value = '{$depts['dept_id']}' $selected>{$depts['dept_name']}</option>"; Each time the while loop iterates, $selected is going to be assigned something. It will either be assigned "SELECTED" or "". If the department id of the department being listed matches the current user's department id, then it will be assigned "SELECTED" if it doesn't, $selected = "". Then just put the $selected in your option tag and the only option tag that will have the SELECTED one is the current user's department.
  15. .josh

    Hey guise

    Apparently I picture you that way.
  16. .josh

    Hey guise

    Hey I never claimed to be some grammar police. Don't get your panties in a wad just cuz someone called you out. Bottom line is that you wanted to complain about other people's writing skills trying to act all superior, and I called you out. Responding with sarcasm is just lame.
  17. Okay so yeah...in your script where the user gets to edit info, including the department, you would initially be basically "select * from employee where EmpID = 'x'" for display/edit, right? So since you do that, you have the Employee.Department value from that already, when you get down to the part where you need the drop down of departments, you would use that code, except change the columns/table to your specific names.
  18. Top 10 link gives a 404 error
  19. Is Employee.Department the actual department name, or is it an id number? Is Employee.Department the same value as Departments.Id, or Departments.Description?
  20. Would also help if you were more specific than "It doesn't work."
  21. well, you can use php to dynamically create text, and js/html is text to php so if you want the text to contain js code to be generated for a popup on one condition but not another, then to that extent, yes, you can use php to do that. Example: $x = 5; if ($x > 0) { // echo js for popup box here } else { // don't echo out js } That code will send the js popup code to the browser, but the point is, the condition will be parsed on the server, and the results will be sent to the browser. <?php echo "something here<br />"; ?> <script language='javascript'> document.write("blahblahblah"); </script> <?php echo "something else here <br />"; ?> php will parse that and send the following to the browser: something here<br /> <script language='javascript'> document.write("blahblahblah<br />"); </script> something else here <br /> So your browser is going to render that text in order, looking like this: The point I'm trying to make is that even if the js was a popup, it will still be rendered in that order, and the 2nd php echoed string will still be there. If he has some php script running and suddenly wants a js popup box to confirm something, he can do that, but he can't for instance have the php script continue to run if he clicks yes, stop if he clicks no, because all of the php is already parsed on the server and sent to the browser.
  22. Okay I'm not sure how you have your table(s) setup but assuming you have what, some kind of account info, with a dept_id field in the account_info table, you would "select dept_name from departments where departments.dept_id = account_info.dept_id" and then pretty much use the same condition as in your OP to mark the current department as selected. // let's just go ahead and assume that you are wanting to select all the info from the account_info // type table so you already have the current dept_id associated with the account // and you have the account info stored in an array called $account_info so the current dept_id // is $account_info['dept_id'] if that's not how you have your script setup then perhaps you need // to better explain your setup. // select all of the dept_name and dept_id from departments, because you're going to // want to change the dept_id in the account_info table if user selects a new one $sql = "select dept_id, dept_name from departments"; $result = mysql_query($sql); while ($depts = mysql_fetch_assoc($result)) { // for each iteration of the loop, we compare the current dept_id to the department's dept_id // and assign something to $selected based on whether it matches or not. $selected = ($account_info['dept_id'] == $depts['dept_id'])? "SELECTED" : ""; // pass the dept_id as the value to change, and use the dept_name for readability echo "<option value = '{$depts['dept_id']}' $selected>{$depts['dept_name']}</option>"; }
  23. except that it's less lines of code and more readable...
  24. array_values ftw
  25. No. PHP is parsed on the server and the resulting output (if any) is sent to the client, along with all the js, html, css, and everything else that's not PHP code. The client then renders it accordingly, executing the javascript, etc..
×
×
  • 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.