0

FORM

<form method="post" action="menu_duzenle_islem.php">
Şuanki İsim : <input name="menu_isim" value="<?php echo $_POST['menu_isim'] ?>"readonly>
Yeni İsim : <input name="yeni_menu_isim" placeholder="isim giriniz.">
Şuanki URL : <input name="menu_url" value="<?php echo $_POST['menu_url'] ?>"readonly>
Yeni URL : <input name="yeni_menu_url" placeholder="url giriniz">
<input type="submit" value="Düzenle">
</form>

menu_duzenle_islem.php

<?php
$con=mysqli_connect("localhost","root","","mmogezgini");
mysqli_query($con,"UPDATE menuler SET isim='$_POST[yeni_menu_isim]' and url='$_POST[yeni_menu_url]'
WHERE isim='$_POST[menu_isim]' AND url='$_POST[menu_url]'");
mysqli_close($con);
Header("Location:menuler.php");
?>

when i update "menu_isim" and "menu_url" menu_isim showing "0" and menu_url doesn't change.

3
  • MySQLi supports multiple statements per query. If you dont escape/bind/prepare your parameters, this is easy way to SQL inject and drop or change all your tables Commented Oct 2, 2013 at 11:09
  • not only is this bad practice syntax: "'$_POST[menu_isim]'", use this: "..." . $_POST['menu_isim'] . "...." Commented Oct 2, 2013 at 11:10
  • @DanFromGermany Thank you for advice i will search for escape function right now. Commented Oct 2, 2013 at 11:33

1 Answer 1

2

Your SQL query is not correct, refer the following:

mysqli_query($con,"UPDATE menuler SET isim='". $_POST['yeni_menu_isim']."' ,url='".$_POST['yeni_menu_url'] ."'
WHERE isim='".$_POST['menu_isim']."' AND url='".$_POST['menu_url']."'");
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it works but why people downvote me this is not for ask what you dont know and answer what you know for helping each other? a time later i will couldn't ask questions :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.