NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page php help

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-13-2005, 12:33 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: May 2005
Posts: 25
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>
????: NamePros.com http://www.namepros.com/programming/123424-php-help.html
                </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>
????: NamePros.com http://www.namepros.com/showthread.php?t=123424
                </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, 12:47 PM   #2 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
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!
mholt is offline  
Old 09-13-2005, 01:36 PM THREAD STARTER               #3 (permalink)
NamePros Member
Join Date: May 2005
Posts: 25
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, 01:38 PM   #4 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
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.
mholt is offline  
Old 09-13-2005, 01:41 PM THREAD STARTER               #5 (permalink)
NamePros Member
Join Date: May 2005
Posts: 25
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, 02:08 PM   #6 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
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.
mholt is offline  
Old 09-13-2005, 02:23 PM   #7 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
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
 

Member of the Month
July 2005

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]')"); 
????: NamePros.com http://www.namepros.com/showthread.php?t=123424
axilant is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 12:35 PM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 10:09 AM
PHP Editor Software List Ber|Art Free Resources 3 08-22-2004 09:59 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:46 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger