Jump to content


Photo

"Update Email" form problem.. MySQL??


  • Please log in to reply
1 reply to this topic

#1 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 12 August 2006 - 10:18 PM

Hi, Im trying to make a simple form where users can update their info.. right now tis super simple, just so i can understand it and advance it later... this code doesnt woprk.. although it doesnt produce any errors... it doesnt update thier email...

<?php
if($_POST['submit1'])
{
$conn = mysql_connect("localhost", "zyco", "****") or die(mysql_error());
mysql_select_db('zyco_zycologin', $conn) or die(mysql_error());
$cNewEmail = $_POST['emailNew'];
$idg = $_SESSION['username'];
$query = "UPDATE `users` SET `email` = '$cNewEmail' WHERE `username` = $idg LIMIT 1 ";
mysql_query($query) or die('Error : ' . mysql_error() );
}
?>

<table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td ><font color=black>New Email:</font></td><td><input type="text" name="emailNew" maxlength="30"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="submit1" value="Update"></td></tr>
</table>
What am i doing wrong..btw. the "***" in the password.. yes i really have my own password, like I said I dont get any DB errors.. or ANY errors at all.
Link shortener with advanced, detailed statistics:

http://tyny.us/

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 12 August 2006 - 10:42 PM

below your query

add this

echo $query;

I have also noticed in your query
$idg needs to be in single quotes
...WHERE username = '$idg' LIMIT...
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users