Jump to content

Archived

This topic is now archived and is closed to further replies.

techiefreak05

"Update Email" form problem.. MySQL??

Recommended Posts

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...

[code]<?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>[/code]
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.