Witam!
Raczkuję dopierow PHP, ale na tyle żeby się uczyć.
Otóż mam problem gdy chcę edytować rekord w bazie używając do tego ID wyświetla mi " udano ", ale tak nie jest.... Oto mój kod
<?php
$host="localhost"; // Host name
$username="user"; // Mysql username
$password="pass"; // Mysql password
$db_name="nazwa"; // Database name
$tbl_name="news"; // Table name
// Connect to server and select databse.
// get value of id that sent from address bar
$id=$_GET['id'];
// Delete data in mysql from row that has this id
$sql="UPDATE $tbl_name
SET title='$_POST[title]', body='$_POST[body]'
WHERE id='$_GET[id]'";
// if successfully deleted
if($result){
echo "Edited Successfully"; echo "<a href='http://36i6.co.uk'>Back to main page</a>"; }
else {
}
// close connection
?>
a to forma
<form action="edit.php" method="post">
<div class="box">
<h1>Add News :</h1>
<label><span>Title</span>
<input type="text" class="input_text" name="title" id="name" value="
<? echo $row['title']?>"/>
</label>
<!-- <label><span>Date</span> -->
<input type="hidden" class="input_text" name="date" id="email"/>
<label><span>Body</span>
<textarea class="message" name="body" id="feedback"></textarea>
<input type="submit" class="button" value="Add" />
</label>
</div>
</form>