ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
Get the id of the fields updated by an update query?
ManiacDan replied to themistral's topic in MySQL Help
But I'm assuming he doesn't have the VALUES. He said he's trying to do something like "the following fields were updated." Even with the ID, he'll need to select the whole row to figure out the differences. -Dan -
If you can't calculate the last column's value on the fly (like in my query) then just pull all the data into a scripting language and make one huge insert out of it. You haven't said how many rows or how you're going to get this mystery column's value.
-
INSERT INTO t1 (col1, col2, col3, col4, col5, col6, col7) SELECT *, SomeFunction(t2.someColumn, 'Make The Data Here') FROM t2 -Dan
-
Yes, pay for the things that you use.
-
Then post what you did to fix it so that others may benefit. Also, there are 4 additional errors on this line. -Dan
-
Data protection for children - UK law question
ManiacDan replied to richrock's topic in Miscellaneous
Whoa there. He's asking whether or not it's legal to do what the client has requested. Yes, the client may have told him to do this, but that doesn't mean it's legal. In some countries it is illegal to record information on children without their parents' consent (or even to allow them to visit your website without permission). Still talk to a real lawyer familiar with your country's laws. -Dan -
Data protection for children - UK law question
ManiacDan replied to richrock's topic in Miscellaneous
This is a question for the client's lawyers, NOT a web developer. You are not a lawyer, and therefore you cannot be trusted to make legal decisions on behalf of the company. If you make the wrong decision and they get prosecuted, they can turn the investigation directly back to you because you didn't seek actual legal counsel. Of course, I'm not a lawyer either, so take that with a grain of salt. -Dan -
I think you just asked the question from your worksheet. Before you can answer "the functionality of the website," you need to discover...the functionality of the website. It's very zen. You cannot simply say "please tell me how a website works," anymore than you can say "please describe the functionality of a building." They want you to write a paragraph or two about whatever the website is going to be, as if you were explaining it to your grandmother. -Dan
-
Seems to be an error from zend-encoding and some other retail scripts. PHPMailer is free, but it may have been encoded as part of a retail package. -Dan
-
Are you asking how you take 7 columns and insert them into a 6 column table? You can't. If you're asking how to ignore a specific column, read the previous reply more carefully. -Dan
-
The error message would probably help, since you're using an aggregate column without the GROUP BY clause. -Dan
-
Yes, you would, that's the whole point of a cross reference table. There is one entry for every relationship. That way, you can easily find anything you're looking for. Databases don't get tired, bored, or overwhelmed. I've run MySQL installations with more than 4 billion rows in each database. Creating a cross-reference table of a few hundred thousand rows isn't going to be an issue, and it will make queries like this so much easier. Plus, have you thought about what would happen if you wanted to delete a relationship? Currently, you have to select the row, modify the list in-line, make sure it's still valid, check to see if the row has been updated in the mean time, then insert the new row value. The correct way, you just delete from the cross reference table where the IDs match the relationship you want to clear. -Dan
-
Get the id of the fields updated by an update query?
ManiacDan replied to themistral's topic in MySQL Help
The select the row before you update it, and compare the current values of the row to what you're about to store in the update statement. -Dan -
Don't ever use addslashes. Use stripslashes on input if magic_quotes are enabled, otherwise use the mysql_real_escape_string function (or its equivalent in whatever database you use) for inserting into your database. Use htmlentities for echoing HTML, mysql_real_escape_string for inserting into mysql. Also, the " symbol is "quotes" or usually "double-quotes." A single ' is an apostrophe when it's inside a word, or "single quotes" when they surround a string. -Dan
-
Fenway, I'd really like to know (non-maliciously) what you think PHP lacks. I've heard a number of people say that PHP isn't a real language, none of them were able to back it up. Is there some esoteric functionality of Perl or Python or C++ that would make PHP into a "real" language in your eyes? Or is it just the fact that PHP started as a quick and dirty HTML looping engine and grew from there?
-
Maybe true in 1996, but it's a fully fleshed out language now. It's also a great language to learn on, because it's loose enough to allow new users to make mistakes and still generate working products. Unfortunately, its main benefit is also its main drawback, because those users never learn the "proper" way of doing things.
-
Access denied for user 'intern'@'%' to database 'my_db'
ManiacDan replied to barnigan's topic in MySQL Help
Bad password. -
The problem is that not enough new programmers understand that PHP and SQL are entirely different languages that have no knowledge or understanding of one another. Then they throw HTML into the mix...then JavaScript...then regexp, and before they know it they're trying to learn 5 languages simultaneously. It's a wonder any of us ever got anything working at all. -Dan
-
sha1 is better than md5. Even better, always use a salt: sha1($password . "someLongStringThatNobodyElseKnows"); That way, even if someone gets a copy of your database, they can't even brute force all the passwords. The key to encrypting passwords is that nobody, not even you, can get the user's plaintext password out of the database. The database itself needs to be secure even if someone gets a copy of it. -Dan
-
First of all, you're using sha1 in the first file and md5 in the second. They are not interchangeable. What you need to do is encrypt the password BEFORE you put it into the database. That's what they mean. Delete the rows in the user table you already have, and change your registration script so that it inserts the sha1() value. That way, when you go to SELECT the sha1() value, it will match. -Dan
-
Right, get rid of $wtf entirely and use $result.
-
Minimeallolla is using the wrong variable name and the wrong method for setting multiple data points into a single variable. Your problem is the lack of mysql_query. -Dan
-
Doing it properly means making this single column its own table. It won't increase the size of your database at all, and it will actually increase the speed. Look into normal forms. Also, read the MySQL manual page you've already been given for the proper syntax. WHERE find_in_set('123', column) != 0
-
When firefox prompts for download of a file, it's usually a header problem. Use the PHP header() function to output the proper headers for a text/html document. -Dan
-
Note that mktime is orders of magnitude faster than strtotime. Use mktime whenever possible. -Dan