Jump to content
php.lv forumi

mysql update problema


Tevocis

Recommended Posts

veidoju failu ar kuru lietotajs var izmainit savu info piemeram vardu epastu u.t.t bet nezin kāpec nedarbojaas itka tur kur es to vsu ar echo izmetu ara ari vis ir ta ka vajag bet lidz datubaazei ta ari netiek.

varbut varat palidzet parabaudiju ar dažiem  validatoriem bet vis itka okay.

 

 

 

<?php
$vards = $_POST['vards'];
$uzvards = $_POST['uzvards'];
$vecums = $_POST['vecums'];
$bilde = $_POST['bilde'];
$epasts = $_POST['epasts'];
$id =  $_SESSION['Memberid'];
echo "UPDATE members SET Username='$vards',uzvards='$uzvards',Vecums='$vecums',bilde='$bilde',Email='$epasts' WHERE Memberid = '$id' ";
if(isset($_POST['submit']))
{

mysql_query("UPDATE members SET Username='$vards',uzvards='$uzvards',Vecums='$vecums',bilde='$bilde',Email='$epasts' WHERE Memberid = '$id' ") or die('Neizdevas labot tavu profilu!!!');
echo 'Profils veiksmigi labots';
header("location: index.php");
}

?>
<form action="" method="post">
<ul>
  <li>
   Vārds: <br>
   <input type="text" id="vards" name="vards" value="<?php echo $_SESSION['Username']   ; ?>">
  </li>
  <li>
   Uzvārds: <br>
   <input type="text" id="uzvards" name="uzvards" value="<?php echo $_SESSION['uzvards']   ; ?>">
  </li>
  <li>
   Vecums: <br>
   <input type="text" id="vecums" name="vecums" value="<?php echo $_SESSION['Vecums']   ; ?>">
  </li>
  <li>
   Bilde: <br>
   <input type="text" id="bilde" name="bilde" value="<?php echo $_SESSION['bilde']   ; ?>">
  </li>
  <li>
   E-Pasts: <br>
   <input type="text" id="epasts" name="epasts" value="<?php echo $_SESSION['Email']   ; ?>">
  </li>
  <li>
   <INPUT type="submit" class="btn btn-primary" tabindex="3">
  </li>
</ul>
</form>
Edited by Tevocis
Link to comment
Share on other sites

lai visi interneta dievi stav klat tam klientam kurs reiz iegadasies so risinajumu bet par lietotaja pusi saja gadijuma nav jauztraucas jo lietotaji pasi viens otra datus pielabos pec vajadzibas kad padosi post datos ari id bet par problemas aprakstu vis ir ta ka vajag bet lidz datubaazei ta ari netiek visticamak ir saistits ar nepilnibām skripta!!!

Link to comment
Share on other sites

nuuu nevar but nepilniba jo datus izvelk ta ka man to vajag bet kad prasu lai to visu updeito uz jaunu infu tad to neizdara es prasu ko man vajadzeetu dairit nevis gudrus textus nevajag ari gatavu risinajumu.un kodu parskatiju vairakas reizes kļudas itka nav

Link to comment
Share on other sites

Nu visadi gadas man ta bija ka prasiju updeitot bet nedara man teica ka update kverijam ir jabut pareiza formata un jadebugo googlejot pec piemeriem var atrast kludu bet ja saki ir ok tad jaraksta mysql supportam ticketu ^^

Link to comment
Share on other sites

Pamēģini, visiem saglabājamiem datiem sākumā šādi.

$vards = $_POST['vards'];

Aiztāt ar 

$vards = mysql_real_escape_string( $_POST['vards'] );

Un, ja parādīsies kaut kāds exception vai error, tas nozīmē, ka tev nav aktīvas mysql konecijas (mysql_connect );

Link to comment
Share on other sites

amm vis darbojas datus izvelk ta ka vaja. bet tad kad spiež pogu submit man neaiziet uz datubāzi jaunais info.

 

 

atrisinaju problemu ar to ka ieliku iekš submit ari name="submit"

Edited by Tevocis
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...