Update Help

This is a discussion on "Update Help" within the PHP Forum section. This forum, and the thread "Update Help are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 17th, 2007, 01:03
Up'n'Coming Member
Join Date: Jan 2006
Location: NI
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Update Help

Hi everyone i am having problems creating a change password function. I did have this working but for some reason it wont now.


Form Code:

HTML: Select all
<form action="updatePass.php" post="post">
<input id="oldpass" type="text" class="contentText" name="oldpass">
<input id="newpass" type="text" class="contentText" name="newpass">
</form>

PHP code:

PHP: Select all

<?php

include "config.php";


$username $_COOKIE['loggedin'];
if (!isset(
$_COOKIE['loggedin'])) die("You are not logged in, <a href=index.html>click here</a> to login.");

mysql_connect($server$db_user$db_pass) or die (mysql_error()); 

mysql_select_db($database)
or die (
"Could not select database because ".mysql_error());

mysql_query("UPDATE $table SET password = '".$_POST['newpass']."'
WHERE password = '"
.$_POST['oldpass']."'");
?>

When i try it at the minute it just deletes the current password from DB.


Any ideas or is there an easier way to do it?


Thanks
Robert
Reply With Quote

  #2 (permalink)  
Old May 17th, 2007, 05:00
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Update Help

method=post not post=post in your form tag?
Reply With Quote
  #3 (permalink)  
Old May 17th, 2007, 06:14
Up'n'Coming Member
Join Date: Jan 2006
Location: NI
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Update Help

Oh my god what a stupid mistake. I spent about two hours on it!!

Thanks
Robert
Reply With Quote
Reply

Tags
password

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with SQL Update webrodie Databases 1 May 11th, 2007 17:20


All times are GMT. The time now is 11:34.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43