-
Posts
97 -
Joined
-
Last visited
Everything posted by Proletarian
-
php.net and mysql.com
-
Select your row, from that row, get the number of updates, add 1 to it, then update your row.
-
By getting the current value from the database then adding 1 to it.
-
You can default values in your table to some kind of value when you define your table.
-
well.. among other issues there is not DELETE in the posted code It looks like he's just overwriting it with blanks, which is kind of like deleting it, just not the actual row; maybe he's not wanting to row, just remove the data in the row. But, I dunno. OP needs to explain intention.
-
Sounds like it would work. But why check if updates are less than 1? Set it so it defaults to 0, then just increment by 1 every time an update occurs.
-
Echo a mysql_error() after your mysql_query(update) statement. Need more details on why "it's not working."
-
Not to sound rude, but it's not a complicated concept. I think of it like this: A class is an abstract object that has dimensions (properties/variables) and can do things (methods/functions). When a class is instantiated, the object will have measurable properties and has the capacity to act. - Class declaration - Public, private, protected properties - Public, private, protected methods Basically, all properties of certain scope in one area and all methods of certain scope in the second area. Public scope is basically anything I want to access straight from the object. Typically, I don't make properties public, I make them private/protected and access/modify them with public methods. To put it in existential terms, if I were an instance of a class, only I would be aware of the values of my (private) properties, while if I wanted to use them or if you wanted to know about me, we would make use of our (public) methods to discover those values or fiddle with them in some way. In code terms, it's like this: <?php class person { //======================================== /*======================================== THINGS THAT DESCRIBE AND QUANTIFY ALL INSTANCES OF THIS CLASS! ========================================*/ private $myName; private $myAge; private $myHeight; private $myWeight; //======================================== /*======================================== THINGS THAT ALL INSTANCES OF THIS CLASS CAN DO! ========================================*/ public function __construct($n, $a, $h, $w) { $this->myName = $n; $this->myAge = $a; $this->myHeight = $h; $this->myWeight = $w; } //======================================== public function change_name($s) { $this->myName = $s; } public function tell_name(&$s) { $s = $this->myName; } //======================================== public function show_age(&$s) { $s = $this->myAge; } public function live_another_day() { $this->myAge++; } //======================================== public function weigh(&$s) { $s = $this->myWeight; } public function measure(&$s) { $s = $this->myHeight; } //======================================== public function lose_weight() { $this->myWeight--; } public function gain_weight() { $this->myWeight++; } //======================================== } /*======================================== AN EXAMPLE OF HOW TWO INSTANCES OF THE SAME CLASS USE THE SAME METHOD AND PROPERTY OUTLINES BUT ACHIEVE INDIVIDUALLY UNIQUE RESULTS. ========================================*/ public function blah() { $me = new person("Alice", 25, 100, 100); $you = new person("Bob", 50, 200, 200); $me->get_name($name); // SHOWING MY NAME echo $name; $you->get_name($name); // SHOWING YOUR NAME echo $name; $me->change_name($name); // CHANGING MY NAME TO YOUR NAME $me->get_name($name2); // SHOWING MY NEW NAME echo $name2; } ?> I hope this example is tutorial enough. If not, well, I hope someone else can expand upon my "tutorial" further.
-
http://www.php.net/manual/en/language.oop5.basic.php
-
Take away the double paranthesis in your VALUES list.
-
var_dump your $link variable. I'm going to take a wild guess and say somewhere else you are echoing a "1" and it just appears that it's tagged on the end and not actually appending a "1" to the path.
-
Password Security during Password Reset
Proletarian replied to doubledee's topic in Application Design
You could do either way, but I think it's a better idea to not remove or alter their original password and just have them reset it themselves with a new password. That way you won't have to generate any temporary passwords or salts or even worry about how safe the temporary password is because there is none. -
Password Security during Password Reset
Proletarian replied to doubledee's topic in Application Design
Why not just email them a link to a page where they can reset their password instead? The page can expire after X amount of time. -
You're getting that warning because $hitid is not an array. Use is_array() to verify this. To extract data from your mysql query, you need to use mysql_fetch_assoc() via a while loop. Inside the while loop is where you apply your foreach loop to extract individual records from each row. Example: $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { foreach ($row as $column => $value) { echo $column . ": " . $value . "<br />"; } }
-
Foreach is a PHP loop type, not a SQL method. Get the result first, then perform a foreach loop on the result.
-
Instead of using a loop to make your string, just use array = implode(", ", array) and then append a "." to close the sentence. For that last question, you'd have to do a foreach loop. Foreach ID, select * from table where id = id, if query return true, then it's already in the list; if not, then you can add it to the list if that's what you intend.
-
Just take your entire second IF clause out and it should work as intended.
-
Validate input and "sanitize" input. Don't just take some user input and assume it's safe to put straight into your database. Make sure it's the right type of data you are expecting to use and not some malicious database injection.
-
I didn't realize that. Thanks for the correction.
-
You need to validate your input to make sure the form has data in the fields before posting. If there are no data in the fields, don't post.
-
<? echo $info['Status'] == ('Sold' || 'on hold') ? "<span class='echo'>".$info['Status']."</span>" :"For sale"; ?>
-
Well, for starters, you need to change "<?" these tags to "<?php" tags.
-
In what way is the script failing?