User Profile Edit Script, Update Script PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
redzonne
Forum Newbie
Posts: 8
Joined: Sun Mar 06, 2005 12:27 pm
Location: Los Angeles

User Profile Edit Script, Update Script PHP

Post by redzonne »

Does anyboby know how to put together a user profile edit script.

I inserted the below code in my edit profile page. It doesn't actually update the database though. I think I'm missing a piece.

Code: Select all

mysql_select_db('realest1_proppost');
  $query2 = "UPDATE customerindex SET cfirstname='$cfirstname', clastname='$clastname', cmidinitial='$cmidinitial', cstaddress='$cstaddress', cunitnum='$cunitnum', ccity='$ccity', czip='$czip', cphone='$cphone', cfax='$cfax', cemail='$cemail' WHERE login='$login', $db";
  $result2 = mysql_query($query2);
  if ($result2)
     echo '<span class=p2><b>Profile Successful</b></span><br /><br />';
     echo '<span class=psparkblu12><b>';
     echo $myrow["login"];
     echo '</b> You have successful updated your user profile for your property posting account</span><br /><br />';
     echo '<a class=pmidblu href="proppost_controlpanel.php">Click here to return to Property Post Control Panel</br></a>';
http://www.realestatenetfind.com/edit_ownersignup.phps

http://www.realestatenetfind.com/edit_o ... nsert.phps


feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd bet it's your $db variable in the query string.. if you change the query call to use mysql_error() on failure, you will find out.
User avatar
redzonne
Forum Newbie
Posts: 8
Joined: Sun Mar 06, 2005 12:27 pm
Location: Los Angeles

mysql_error()

Post by redzonne »

Whoa!! your right!

I changed
$result2 = mysql_query($query2);
to
$result2 = mysql_query($query2) or die(mysql_error());

and I got the following error:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' Resource id #11' at line 1

Not quite sure what it means though...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$db is supposed to be passed to mysql_query() via the second argument, not in the query string.
Post Reply