[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 09-13-2005, 11:33 AM   #1 (permalink)
NamePros Member
 
Join Date: May 2005
Posts: 25
25.00 NP$ (Donate)

Halbarad is an unknown quantity at this point


php help

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"); ?>
Halbarad is offline  
Old 09-13-2005, 11:47 AM   #2 (permalink)
DNOA Member
 
mholt's Avatar
 
Join Date: May 2004
Location: Utah
Posts: 5,041
18.01 NP$ (Donate)

mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future

Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
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]')"
)
Check the syntax of that You declare a variable right in the middle of an SQL query!
__________________
codeboards

A high-quality community of programmers -- Join today and post! We want new members!
mholt is offline  
Old 09-13-2005, 12:36 PM   #3 (permalink)
NamePros Member
 
Join Date: May 2005
Posts: 25
25.00 NP$ (Donate)

Halbarad is an unknown quantity at this point


you mean this line?
$affected_rows = $sql->id = $_SESSION[id];
Halbarad is offline  
Old 09-13-2005, 12:38 PM   #4 (permalink)
DNOA Member
 
mholt's Avatar
 
Join Date: May 2004
Location: Utah
Posts: 5,041
18.01 NP$ (Donate)

mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future

Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Yes. You can't declare a variable in a MySQL query.
__________________
codeboards

A high-quality community of programmers -- Join today and post! We want new members!
mholt is offline  
Old 09-13-2005, 12:41 PM   #5 (permalink)
NamePros Member
 
Join Date: May 2005
Posts: 25
25.00 NP$ (Donate)

Halbarad is an unknown quantity at this point


but this can not be the problem cuz if i put it outside the MySQL query it still doesnt work.

any other suggestions
Halbarad is offline  
Old 09-13-2005, 01:08 PM   #6 (permalink)
DNOA Member
 
mholt's Avatar
 
Join Date: May 2004
Location: Utah
Posts: 5,041
18.01 NP$ (Donate)

mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future

Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Why is there a comma in "VALUES(," .... that should not be there.
__________________
codeboards

A high-quality community of programmers -- Join today and post! We want new members!
mholt is offline  
Old 09-13-2005, 01:23 PM   #7 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


PHP Code:
$affected_rows = $sql->id = $_SESSION[id];
$query = mysql_query("update set members
    (province, kingdom, email, msn, password)
    VALUES ('$_POST[province]','$_POST[kingdom]','$_POST[email]','$_POST[msn]','$_POST[password]')"
);
axilant is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 11:35 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
PHP Editor Software List Ber|Art Free Resources 3 08-22-2004 08:59 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 12:08 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85