Jump to content

cannot make the change in db...


newbieaj

Recommended Posts

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)

   

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

:)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.