xfr33 Posted July 5, 2009 Report Share Posted July 5, 2009 Labdien! Tātad updeitojot tabulu mysql vienīgais, uz ko apdeito ir "0". Var ievadīt jebkuru informāciju, bet apdeitos uz 0. Kāds var palīdzēt? <?php session_start(); $c = mysql_connect("localhost", "root", "") or die(mysql_error()); $d = mysql_select_db("a2599236_users", $c); $username = $_SESSION['username']; $email = $_POST['email']; $name = $_POST['name']; $surname = $_POST['surname']; $password = $_SESSION['password']; $result = mysql_query("UPDATE users SET email='$email' AND name='$name' AND surname='$surname' WHERE username='$username'") or die(mysql_error); header('Location:profile.php'); ?> <?php session_start(); $c = mysql_connect("localhost", "root", "") or die(mysql_error()); $d = mysql_select_db("a2599236_users", $c); $data = mysql_query("SELECT * FROM users WHERE username=\"". $_SESSION['username'] ."\"") or die(mysql_error); while($info = mysql_fetch_array( $data )) { echo "<form action=\"profile_edit.php\" method=\"post\"> Lietotājvārds: <br /> <input type=\"text\" name=\"username\" value=\"". $info['username'] ."\" /><br /> Epasta adrese: <br /> <input type=\text\" name=\"email\" value=\"". $info['email'] ."\" /><br /> Vards: <br /> <input type=\"text\" name=\"name\" value=\"". $info['name'] ."\" /><br /> Uzvards: <br /> <input type=\"text\" name=\"surname\" value=\"". $info['surname'] ."\" /><br /> <input type=\"submit\" value=\"Saglabat izmainas\" /> </form>"; } ?> Jau iepriekš paldies! Quote Link to comment Share on other sites More sharing options...
Prayer !! Posted July 5, 2009 Report Share Posted July 5, 2009 $result = mysql_query("UPDATE users SET email='$email' AND name='$name' AND surname='$surname' WHERE username='$username'") or die(mysql_error); $result = mysql_query("UPDATE users SET email='$email', name='$name', surname='$surname' WHERE username='$username'") or die(mysql_error()); Neko daudz nepetiju, bet lieta ko uzreiz ieraudzīju bija nepareizs kvērijs sql.. Quote Link to comment Share on other sites More sharing options...
usver Posted July 5, 2009 Report Share Posted July 5, 2009 1) lieto mysql_real_escape_string(), piem $email = mysql_real_escape_string($_POST['email']);, savādāk tava sistēma būs caurstaigājama ( varēs ienākt katrs, kam nav slinkums). 2) "UPDATE users SET email='$email', name='$name', surname='$surname' WHERE username='$username'"; Quote Link to comment Share on other sites More sharing options...
xfr33 Posted July 6, 2009 Author Report Share Posted July 6, 2009 Liels paldies :) Quote Link to comment 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.