ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
@Mahngiel: Good luck to you. If you're near a national border, I have a few relatives in Border Patrol and they love it (especially if you're bilingual). If not that, look into the Marshall's or the DA's squad, especially with a military background. @AcEBALL23: What have you tried so far? You can't just copy and paste your homework and expect us to do it for you.
-
Ah, criminal justice. I knew a lot of social workers (dated a few, in fact) who did similar classes. Don't know why anyone would voluntarily get an MSW, your path is much more lucrative and powerful, while still allowing you to help people.
-
Did you just make that topic up, or are you studying to be a social worker or something?
-
We're starting this again already?
-
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
Requinix caught his SQL injection bugs days ago. NOBODY CARES ABOUT YOUR OPINIONS CHRISTIANF -
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
FIND_IN_SET is an ironic function, because it's only useful in incorrectly done databases. It's like they finally gave up and wrote bad database design into their query language. -
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
-
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
I was sarcastic for one sentence in my essay there. Unless YOU'RE being sarcastic...right now. It's not as easy as jcbones makes it seems. -
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
He'll figure out the "why" soon enough on his own, but since you appear to be reasonable and interested I'll explain: By storing a delimited list in a single field, you remove your ability to search, sort, update, and delete. That's basically the entire point of databases now isn't it? If my data looks like this: 1,5,234,88,124,2,79 How do I search for anything matched to number 88? The only real way to do that is: WHERE FIND_IN_SET(88, theField); You could also do: WHERE theField LIKE '88,%' OR theField LIKE '%,88,%' OR theField LIKE '%,88' Both of those queries are very very inefficient, because they require parsing huge string lists. Now how do you return the item with the largest number of IDs associated with it? You...can't really. I guess you could try to count the number of commas: SELECT name, (LENGTH(theField) - LENGTH(REPLACE(theField, ',', ''))) / LENGTH(',') FROM theTable GROUP BY theField ORDER BY (LENGTH(theField) - LENGTH(REPLACE(theField, ',', ''))) / LENGTH(',') DESC What about editing? How do I remove ID 88 from a specific record? Well that's easy! I just...select it out of the database...put it into a PHP variable...explode it...loop through it...unset the proper index...implode it...and reinsert it into the database. If the original advice of a lookup table was used INSTEAD, what we have is: Find things linked to 88: SELECT theTable.* FROM theTable JOIN lookupTable USING (id) WHERE lookupTable.lookup = 88; Find all things ordered by number of lookups: SELECT theTable.name, COUNT(lookupTable.lookup) FROM theTable JOIN lookupTable USING (id) GROUP BY theTable.name ORDER BY COUNT(lookupTable.lookup) DESC; Delete 88 from record 5: DELETE FROM lookupTable WHERE id = 5 AND lookup = 88; Once the tables are done correctly, every query is very basic datbase 101. You don't need an entirely separate programming language, you don't need to wrap your head about the stupid voodoo magic I did with the LENGTH() function, you don't need to handle edge cases involved in lists of numbers, your stuff is designed right so it works right And that, is why we said he was doing it wrong. He was. -
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
You are doing it wrong. Sorry if that upsets you. Doing it right is way easier. You'll see what we mean in just a little while. And when you post on a forum, you're asking members to comment. You're demanding that their comments be direct answers to your questions, but there's nothing anywhere which requires us to say "yes sir right away sir" and go google something for you. You're asking for our comments, which are opinions or advice. Our advice is universally "do it another way, this way is wrong." Good luck with that design. Not too much longer now before you have your "oh" moment. -
Insert Checkbox Values Into Table As Delimited String
ManiacDan replied to acidking's topic in PHP Coding Help
You're learning wrong. You are learning the wrong way. Once you've "learned," the way you do things will be wrong, and nobody will hire you. I'm not sure why that's "bull$hit" advice. You are doing it wrong. You're learning the wrong way. Why would you learn to do it wrong if you're learning? Start out doing it right. We're happy to give you answers. In fact, you asked "how do I implode a list" and instead of getting the wrong answer, you got expert level advice on system design. If all you want is a robot to tell you how to implode a list, use google, not a forum. You asked a group of experts for their opinion, and you got it. -
I've been asked to do a number of applications for potential employers. One of them was small enough and easy enough that I actually did it, but it took me half an hour while I was watching TV. They never called me back. I ended up walking right past their office a few months later and noticed their logo on the door, so I went inside and asked to speak to the guy who asked for the assignment. He refused to come out of his office. They probably used my stupid address book in production for a while, complete with the subtle security holes I put into it on purpose. You did free work for someone, you generated an entire application you could have sold for hundreds of dollars. At the very least you could have attached a copyright notice to the code, though they probably don't care. Wait a couple weeks, see if they're using something on their sites or client sites that looks like what you wrote. If it does, send them a take-down notice. If possible, send it to the client instead of the people who scammed you.
-
How Do I Change P Class Based On A Condition?
ManiacDan replied to wright67uk's topic in PHP Coding Help
"Short tags" were marked for removal in PHP6, but that "official" decision is nowhere to be found in their changelogs. Googling for it produces many articles like this one reporting on the short tag removal (which applied to both <? ?> and <?=$var?>). As far as I can tell: Short tags and short tag echoes were considered the same thing, and controlled by an ini setting. They were deprecated briefly in the spring 2009. That decision was reversed in the summer of 2009 (and I didn't notice). PHP 5.4 split short tags and short echoes into two separate features, and turned short echoes on regardless of short tag settings. -
Fatal Error: Call To Undefined Function Mysql_Nums_Rows()
ManiacDan replied to Nightasy's topic in PHP Coding Help
50,000 more users like this one, please. And cheese sauce on the side. -
Looks like our scammer said "make me this small little thing that nobody will use, and if it's good enough, I'll give you the real work."
-
So store the editable bits in the database, and the template on the filesystem. When user B goes to view the page, select all of user A's inputs from the table, and str_replace them into the template (or use a templating engine)
-
+1. Super bad. Store placeholders in your templates. Use a templating language like twig or smarty to replace the values you want.
-
He could send all the invoices he wants, he agreed to do work for free with no expectation of pay and no mention of how that work would be used once it was judged.
-
Yeah he probably is using your "test" right now without paying you.
-
Whenever they're in their office talking to each other, or complaining about the users, that show makes me laugh so hard my sides hurt. When they cut away from the office, the nerd writers suddenly don't know what's funny in the real world, so they fall back to dick and fart jokes. One episode was about how "gross" it is to date a trans woman. There was a 3-episode story arc about the CEO trying to rape the female lead. When he raped the two male leads instead, that was supposed to be hilarious. He was then fitted with electric pants which gave his genitals an electric shock whenever he became aroused at work. Stick to Roy and Moss arguing in the office and I'll watch it again. I don't feel like sitting through another "hilarious" rape scene.
-
What is the actual problem? Spell it out with capital letters and punctuation so we can understand it. Then we can give you a real solution. Once again, we need you to understand this: What you're doing accomplishes nothing as far as we understand your problem.
-
It would take me an extra 3 minutes to get around this security restriction of yours. Plus, I would never allow anyone to send me obfuscated code and expect me to run it. If this is a real problem, a sternly worded email would be more effective than this.
-
What the heck are you talking about? What did you convert into base64 and why did you do that?
-
How Do I Change P Class Based On A Condition?
ManiacDan replied to wright67uk's topic in PHP Coding Help
You're right, it was marked for permanent deletion and then they changed their mind. With that amount of back and forth I don't trust them for it, but as of this writing they're "always available" -
Rotating Banner Stop Rotating When I Remove A Link.
ManiacDan replied to Beeeeney's topic in Javascript Help
Well good luck with that then. We can't help you fix your javascript by looking at random snippets of your PHP any more than we can help you fix your car by looking at pictures of your dog.