newbieaj Posted October 9, 2008 Share Posted October 9, 2008 hey guy when i make the change to fname, laname and email(which were perviously disabled).. it says that the change is successfully made but the change doesnot reflect.. where as changes to other field reflect here is the code pls chk.... <?php if(isset($vars['err'])) { ?> <p class="message <?=$vars['errclass']?>"><?=$vars['err']?></p> <?php } ?> <h2>Edit My Profile</h2> <form action="?m=profile" method="post"> <table> <tr> <td style="width: 10em">First Name*</td> <td><input type="text" name="fname" id="fname" value="<?=$vars['profile']['fname']?>" size="20" ></td> </tr> <tr> <td style="width: 10em">Last Name*</td> <td><input type="text" name="lname" id="lname" value="<?=$vars['profile']['lname']?>" size="20" ></td> </tr> <tr> <td>Email*</td> <td><input type="text" name="email" id="email" value="<?=$vars['profile']['email']?>" size="30" ></td> </tr> <tr> <td>Phone #</td> <td><input type="text" name="txtPhoneNum" id="txtPhoneNum" value="<?=$vars['profile']['txtPhoneNum']?>" size="18" /></td> </tr> <tr> <td>Web Sites</td> <td><table> <tr><td>Facebook</td> <td><input type="text" name="urlFacebook" id="urlFacebook" value="<?=$vars['profile']['urlFacebook']?>" size="45" /></td></tr> <tr><td>MySpace</td> <td><input type="text" name="urlMyspace" id="urlMyspace" value="<?=$vars['profile']['urlMyspace']?>" size="45" /></td></tr> <tr><td>Linked In</td> <td><input type="text" name="urlLinkedin" id="urlLinkedin" value="<?=$vars['profile']['urlLinkedin']?>" size="45" /></td></tr> <tr><td>Other</td> <td><input type="text" name="urlOther" id="url" value="<?=$vars['profile']['urlOther']?>" size="45" /></td></tr> </table> </td> </tr> <tr> <td>Major</td> <td><input type="text" name="major" id="major" value="<?=$vars['profile']['major']?>" size="45" /></td> </tr> <tr> <td>Minor</td> <td><input type="text" name="minor" id="minor" value="<?=$vars['profile']['minor']?>" size="45" /></td> </tr> <tr> <td>Address</td> <td><textarea name="txtAddress" rows="8" cols="55"><?=$vars['profile']['txtAddress']?></textarea></td> </tr> <tr> <td>About Me</td> <td><textarea name="txtBio" rows="8" cols="55"><?=$vars['profile']['txtBio']?></textarea></td> </tr> <tr> <td>Personal Quote</td> <td><textarea name="txtQuote" rows="8" cols="55"><?=$vars['profile']['txtQuote']?></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="profile" value="Edit Profile" /></td> </tr> </table> <p>* Required field</p> </form> <h2>Change My Password</h2> <form action="" method="post"> <p>You can change your password here. Just type it in both boxes to verify, then press change.</p> <label>New password</label> <input type="password" name="pw" /><br /> <label>Confirm</label> <input type="password" name="pw2" /><br /> <input type="submit" name="changepw" value="Change PW"/> </form> <h2>My PLP Events</h2> <?if(count($vars['programs']) == 0 ){?> <p>No upcoming or historical events</p> <?} else {?> <table style="margin-bottom: 1em"> <tr> <th>Title/Desc</th> <th style="width: 80px">Date</th> <th>Location</th> </tr> <tr> <th colspan="3"> <span style="font-size: 1.5em">Upcoming</span> </th> </tr> <? $future=true; foreach($vars['programs'] as $date=>$event) { if($future && (date('Y-m-d')>$date)) { $future=false; echo ' <tr> <th colspan="3"> <span style="font-size: 1.5">Past</span> </th> </tr> <tr> <th>Title/Desc</th> <th>Date</th> <th>Location</th> </tr>'; } echo ' <tr> <td><span style="font-size: 1.2em">'.$event['title'].'</span><br /><span style="font-size: .9em">'.$event['descr'].'</span></td> <td>'.date('M d, y', strtotime($date)).'</td> <td>'.$event['location'].'</td> </tr>'; } echo ' </table>'; } ?> (edited by kenrbnsn to add tags) Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/ Share on other sites More sharing options...
MatthewJ Posted October 9, 2008 Share Posted October 9, 2008 You need to post the code that does the update.. Not the form code Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-660970 Share on other sites More sharing options...
newbieaj Posted October 9, 2008 Author Share Posted October 9, 2008 thts the code which makes the update....... cause cannot find any separate update code........ or else if u can tell me where to find it...... i am novice so dnt knw much abt things........ Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-660980 Share on other sites More sharing options...
budimir Posted October 9, 2008 Share Posted October 9, 2008 This is not the code we neeed to see. Send the code with query update. Also, it's quite poorly written. Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-660990 Share on other sites More sharing options...
newbieaj Posted October 9, 2008 Author Share Posted October 9, 2008 hey wrote the mysql code myslef but its giving an error Parse error: parse error, unexpected '[', expecting '(' i cannot find the sql update code can u tell me how should i find it? <tr> <td>Personal Quote</td> <td><textarea name="txtQuote" rows="8" cols="55"><?=$vars['profile']['txtQuote']?></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="profile" value="Edit Profile" /> <?php if(isset['submit']) { $username=$_GET["username"]; mysql_connect("localhost","root"); mysql_select_db("Plp"); $query1= mysql_query("update members where pkid= '$pkid'") or die("Database error"); $result = mysql_query($query1); $row1=mysql_fetch_array($result); if($row1) { echo "update successful"; } else { loginError= "didnt match with the database"; echo "$loginError"; } } ?></td> </tr> </table> <p>* Required field</p> </form> Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-661009 Share on other sites More sharing options...
newbieaj Posted October 9, 2008 Author Share Posted October 9, 2008 hey wrote the mysql code myslef but its giving an error Parse error: parse error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM i cannot find the sql update code can u tell me how should i find it? <tr> <td>Personal Quote</td> <td><textarea name="txtQuote" rows="8" cols="55"><?=$vars['profile']['txtQuote']?></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="profile" value="Edit Profile" /> <?php if(isset(submit)) { $username=$_GET["username"]; mysql_connect("localhost","root"); mysql_select_db("Plp"); $query1= mysql_query("update members where pkid= '$pkid'") or die("Database error"); $result = mysql_query($query1); $row1=mysql_fetch_array($result); if($row1) { echo "update successful"; } else { loginError= "didnt match with the database"; echo "$loginError"; } } ?></td> </tr> </table> <p>* Required field</p> </form> Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-661035 Share on other sites More sharing options...
budimir Posted October 9, 2008 Share Posted October 9, 2008 <?php if($_POST["profile"]) { $username=$_GET["username"]; //Why are you using this??? mysql_connect("localhost","root",""); //You need pass, although it's empty mysql_select_db("Plp"); $query= mysql_query("UPDATE members WHERE pkid= '$pkid'") or die (mysql_error()); //Where do you get $pkid variable??? $num=mysql_num_rows($query); if($num == 1) { echo "update successful"; } else { $loginError= "didnt match with the database"; echo "$loginError"; } } ?> I assume that you took somebodys code and now it's not working. The code that you wrote is very bad and non functional, you had a lot of errors. I don't know will this work in the way you wanted, becasue I don't know what is it supposed to do. I just corrected the code so it could work. Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-661083 Share on other sites More sharing options...
MatthewJ Posted October 9, 2008 Share Posted October 9, 2008 I agree with Budimir... You may want to start from scratch and see where that gets you... Understanding what your code is doing is invaluable to troubleshooting. Quote Link to comment https://forums.phpfreaks.com/topic/127720-cannot-make-the-change-in-db/#findComment-661203 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.