Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 09-13-2005, 01:33 PM Help needed
Experienced Talker

Posts: 49
Trades: 0
Hi,

i am trying to learn PHP and no i have managed to create member system with memberlist with help. And now i want to add a function that allows members to edit their information.

I tried it with this code but it does not work at all:
please help me out a bit!
PHP Code:
<?php
session_start
(); 

if (!empty(
$_POST[username]))
{
    if (
$_POST[password] != $_POST[password2])
        exit(
"Error - Passwords don't match. Please go back and try again.");

    require_once(
"connect.php");

    
$query mysql_query("update set members 
    (province, kingdom, email, msn, password)
    
$affected_rows = $sql->id = $_SESSION[id];
    VALUES    (,'
$_POST[province]','$_POST[kingdom]','$_POST[email]','$_POST[msn]','$_POST[password]')")

    or die (
"Error - Couldn't edit account.");
    
 include(
"header.inc"); 
    echo 
"You have succesfully edited your account!<br /><br />
        Please login <a href='login.php'><b>here</b></a>."
;
 include(
"footer.inc"); 
    exit();
}

?>


<?php include("header.inc"); ?>        <form action="account.php" method="post">
            <table width="75%" align="center" cellpadding="3" cellspacing="1" style="border: 5px solid #FFFFFF">
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><b>edit your account</b></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><label>Province Name: <br /><input type="text" name="province" size="20" value="<? echo $_POST[province]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><label>Kingdom Coordinates: <br /><input type="text" name="kingdom" size="20" value="<? echo $_POST[kingdom]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><label>Email: <br /><input type="text" name="email" size="20" value="<? echo $_POST[email]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><label>MSN: <br /><input type="text" name="msn" size="20" value="<? echo $_POST[msn]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><label>Password: <br /><input type="password" name="password" size="20" value="<? echo $_POST[password]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><label>Verify Password: <br /><input type="password" name="password2" size="20" value=""></label></td>
                </tr>
                <tr>
                    <td width="100%" style="font-family: verdana; font-size: 10px"><input type="submit" value="Edit!"></td>
                </tr>
            </table>
        </form>
<?php include("footer.inc"); ?>
__________________

Please login or register to view this content. Registration is FREE
: a freelance webdesign service blog!

Last edited by Halbarad; 09-13-2005 at 01:41 PM..
Halbarad is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-13-2005, 03:49 PM
Experienced Talker

Posts: 49
Trades: 0
bump
__________________

Please login or register to view this content. Registration is FREE
: a freelance webdesign service blog!
Halbarad is offline
Reply With Quote
View Public Profile
 
Old 09-13-2005, 04:51 PM
Super Talker

Posts: 116
Trades: 0
whats the error thats returned?

i see that u need single quotes around some of ur POST variables. like it should be $_POST['username']
__________________


Please login or register to view this content. Registration is FREE

nasaboy007 is offline
Reply With Quote
View Public Profile Visit nasaboy007's homepage!
 
Old 09-13-2005, 05:03 PM
Experienced Talker

Posts: 49
Trades: 0
its doesn't return any error, it just doesnt update the database
__________________

Please login or register to view this content. Registration is FREE
: a freelance webdesign service blog!
Halbarad is offline
Reply With Quote
View Public Profile
 
Old 09-13-2005, 05:10 PM
AxE
AxE's Avatar
Skilled Talker

Posts: 62
Trades: 0
PHP Code:
  $query mysql_query("update set members
    (province, kingdom, email, msn, password)
    
$affected_rows = $sql->id = $_SESSION[id];
    VALUES    (,'
$_POST[province]','$_POST[kingdom]','$_POST[email]','$_POST[msn]','$_POST[password]')"
Try

PHP Code:
  $query mysql_query("UPDATE `members`
SET `province` = '"
.$_POST['province']."',`kingdom` = '".$_POST['kingdom']."',`email` = '".$_POST['email']."',`msn` = '".$_POST['msn']."',`password` = '".$_POST['password']."'
WHERE `id`='"
.$_SESSION['id']."'"); 
I think the WHERE part is right, though not certain. The other part should work.
AxE is offline
Reply With Quote
View Public Profile
 
Old 09-14-2005, 04:50 PM
Experienced Talker

Posts: 49
Trades: 0
nope it still doesnt work

@ AxE: when i try your option, i get this message:

Parse error: parse error, unexpected T_LOGICAL_OR in /home/halbarad/public_html/ai/account.php on line 17
__________________

Please login or register to view this content. Registration is FREE
: a freelance webdesign service blog!

Last edited by Halbarad; 09-14-2005 at 04:53 PM..
Halbarad is offline
Reply With Quote
View Public Profile
 
Old 09-15-2005, 01:13 AM
AxE
AxE's Avatar
Skilled Talker

Posts: 62
Trades: 0
Which line is 17? The query line?
AxE is offline
Reply With Quote
View Public Profile
 
Old 09-15-2005, 11:50 AM
Experienced Talker

Posts: 49
Trades: 0
yeah it is
__________________

Please login or register to view this content. Registration is FREE
: a freelance webdesign service blog!
Halbarad is offline
Reply With Quote
View Public Profile
 
Old 09-15-2005, 02:31 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
What's this doing in your query? :

PHP Code:
$affected_rows $sql->id $_SESSION[id]; 
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 09-18-2005, 05:59 AM
Experienced Talker

Posts: 49
Trades: 0
i have allready removed that my query is now
PHP Code:
$query mysql_query("UPDATE `members` 
SET `province` = '"
.$_POST['province']."',`kingdom` = '".$_POST['kingdom']."',`email` = '".$_POST['email']."',`msn` = '".$_POST['msn']."',`password` = '".$_POST['password']."' 
WHERE `id`='"
.$_SESSION['id']."'"); 
__________________

Please login or register to view this content. Registration is FREE
: a freelance webdesign service blog!
Halbarad is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help needed
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31396 seconds with 12 queries