...

View Full Version : update profile not success



dea
01-31-2007, 02:09 AM
may i post code through here?
but the code is exceed maximum character length..
so what can do?

Jasen Hicks
01-31-2007, 02:15 AM
Try splitting it up in 2 or 3 posts if you need to :thumbsup:

Jasen

StupidRalph
01-31-2007, 02:28 AM
Try splitting it up in 2 or 3 posts if you need to :thumbsup:

Jasen

Actually, don't do that. Instead of posting your entire script and have us comb thru it. Try posting only the relevant parts that are giving you trouble. Your thread isn't very descriptive. You may want to check out the Rules (http://www.codingforums.com/rules.htm) & Posting Guidelines (http://www.codingforums.com/postguide.htm)

dea
01-31-2007, 02:40 AM
<?php
ob_start();
session_start();

require ('config.php');

print '<h2>Edit My Profile</h2>';

if (isset($_POST['cancel'])){
header ('Location: viewProfile.php');
exit();
}

if (isset($_POST['save'])){

$query="UPDATE member SET
username='{$_POST['username']}', memb_id='{$_POST['memb_id']}',
password='{$_POST['password']}',
phone_no='{$_POST['phone_no']}',
month='{$_POST['month']}',
day='{$_POST['day']}',
year='{$_POST['year']}',
WHERE memb_id='{$_POST['memb_id']}' ";

$r=mysql_query($query);

if(mysql_affected_rows()==1){
print '<p>Your profile has been updated.</p>';
}else{
print '<p>Sorry, your profile could not update now. Please try again later!</p>';
}

}else{

if(is_numeric($_GET['memb_id'])){

$query="SELECT * FROM member WHERE memb_id={$_GET['memb_id']}";

if($r=mysql_query($query)){

$row=mysql_fetch_array($r);

echo "<form action='editProfile.php' method='POST'>


<table border=0>
<tr>
<td>Username:</td>
<td><input type='text' name='username' size='20' value=".$row['username']."></td>
</tr>

<tr>
<td>Email Address:</td>
<td><input type='text' name='memb_id' size='20' value=".$row['memb_id']."></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='text' name='password' size='20' value=".$row['password']."></td>
<td>6 characters or more; capitalization matters!</td>
</tr>

<tr>
<td>Phone Number:</td>
<td><input type='text' name='phone_no' size='20' value=".$row['phone_no']."></td>
</tr>


<tr valign='top'>
<td>Date of Birth:</td>
<td><select name='month' >
<option value=".$row['month'].">".$row['month']."</option>
<option value='January'>
January
</option>
<option value='February'>
February
</option>
<option value='March'>
March
</option>
<option value=' April'>
April
</option>
<option value='May'>
May
</option>
<option value='June'>
June
</option>
<option value='July'>
July
</option>
<option value='August'>
August
</option>
<option value='September'>
September
</option>
<option value='October'>
October
</option>
<option value='November'>
November
</option>
<option value='December'>
December
</option></select>

<select name='day' >
<option value=".$row['day'].">".$row['day']."</option>
<option value='1'>
1
</option>
<option value='2'>
2
</option>
<option value='3'>
3
</option>
<option value='4'>
4
</option>
<option value='5'>
5
</option>
<option value='6'>
6
</option>
<option value='7'>
7
</option>
<option value='8'>
8
</option>
<option value='9'>
9
</option>
<option value='10'>
10
</option>
<option value='11'>
11
</option>
<option value='12'>
12
</option>
<option value='13'>
13
</option>
<option value='14'>
14
</option>
<option value='15'>
15
</option>
<option value='16'>
16
</option>
<option value='17'>
17
</option>
<option value='18'>
18
</option>
<option value='19'>
19
</option>
<option value='20'>
20
</option>
<option value='21'>
21
</option>
<option value='22'>
22
</option>
<option value='23'>
23
</option>
<option value='24'>
24
</option>
<option value='25'>
25
</option>
<option value='26'>
26
</option>
<option value='27'>
27
</option>
<option value='28'>
28
</option>
<option value='29'>
29
</option>
<option value='30'>
30
</option>
<option value='31'>
31
</option></select>

<select name='year' >
<option value=".$row['year'].">".$row['year']."</option>
<option value='2004'>
2004
</option>
<option value='2003'>
2003
</option>
<option value='2002'>
2002
</option>
<option value='2001'>
2001
</option>
<option value='2000'>
2000
</option>
<option value='1999'>
1999
</option>
<option value='1998'>
1998
</option>
<option value='1997'>
1997
</option>
<option value='1996'>
1996
</option>
<option value='1995'>
1995
</option>
<option value='1994'>
1994
</option>
<option value='1993'>
1993
</option>
<option value='1992'>
1992
</option>
<option value='1991'>
1991
</option>
<option value='1990'>
1990
</option>
<option value='1989'>
1989
</option>
<option value='1988'>
1988
</option>
<option value='1987'>
1987
</option>
<option value='1986'>
1986
</option>
<option value='1985'>
1985
</option>
<option value='1984'>
1984
</option>
<option value='1983'>
1983
</option>
<option value='1982'>
1982
</option>
<option value='1981'>
1981
</option>
<option value='1980'>
1980
</option>
<option value='1979'>
1979
</option>
<option value='1978'>
1978</option>
</select>
</td>
</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign='top'> <div align='left'>
<input type='hidden' name='memb_id' value=".$_GET['memb_id'].">
<input type='submit' name='save' value='Save'>
<input type='submit' name='cancel' value='Cancel'>

</div></td>
</tr></form>
</table>";

}else{
print 'Could not retrieve the record because:<b>'.mysql_error().'</b>. </p>';
}

}else{
print'<p><b>You must have made a mistake in using this page.</b></p>';
}
}
?>

StupidRalph
01-31-2007, 02:54 AM
Actually, don't do that. Instead of posting your entire script and have us comb thru it. Try posting only the relevant parts that are giving you trouble. Your thread isn't very descriptive. You may want to check out the Rules (http://www.codingforums.com/rules.htm) & Posting Guidelines (http://www.codingforums.com/postguide.htm)
Please refer to the posting rules and guidelines. You should wrap all of your php code with the PHP tags by clicking the little PHP Icon in the posting textbox. Also, you did not describe your problem. I doubt you will receive any additional replies until you correct this.

dea
01-31-2007, 03:03 AM
thank you



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum