Jump to content

ChrisC123

Members
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    New England, USA

ChrisC123's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I hate asking for help (some searches usually find the answer), but I can't figure this one out.... I need to strip a handful of possible characters off the end of a variable and have been playing with trim, str_replace and preg_replace with no luck. I can get them to work fine with a specific name/characters but not one that covers all possible options. Our employees desktop and laptops use a standard naming convention that could have multiple characters at the end of their device name which is based on their name. I am trying to strip off all characters to just get the employee name. Here are some examples of our devices name: JDOE JDOE_L JDOE-L JDOE-L2 (or any numeric range such as 2-9) JDOE2 (or any numeric range such as 2-9) I am trying to get only the JDOE from the device name. Any help would be great. Thanks!
  2. Yep. Got it. Thanks! I had already done a good amount of reading on normalization and refined my db structure once from that reading. After your suggestion one search I did was for “data normalization multiple int one column” which did have some interesting info on making that work. After an hour or so of reading I ended up coming to the conclusion that I was doing it all wrong in the first place and once again made changes to my db structure removing the need for my original question and trying to adhere more closely to the normal form. Thanks again.
  3. Hello all. I am fairly new to php/mysql and have been using it daily for about two months now. I was wondering what alternatives I could use to replace multiple columns that all hold similar data? I am big on searching for solutions, I am just having a hard time figuring out what it is I need to search for. Right now I have a table called 'user' with three simular columns called: pri_device_id sec_device_id alt_device_id They all can either be null or have an INT(11) from table 'devices', column 'device_id'. I have been using simple query selects and if else functions up to this point. The problem is that there are rare situations when there might be more than three assigned devices per user (or none and all) and it just seems like there would be a better way to do this with only one columnsomehow holding multiple ids. Any ideas? Thanks.
×
×
  • 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.