开发者

question of update data in php

开发者 https://www.devze.com 2023-02-28 23:18 出处:网络
$query =\"SELECT * FROM activites\"; $queryc = mysql_query($query); while( $row = mysql_fetch_array($queryc))
$query ="SELECT * FROM activites";
$queryc = mysql_query($query); 
while( $row = mysql_fetch_array($queryc))
{ 
  echo '<table>';
  echo '<tr><th colspan="3"><form action="CRUD/modiftitle.php" method="POST"><input    type="text" name="title" value="'.$row['title'].'" /><input type="submit" name="modify" value="Modify" /></form></th></tr>';
  echo '</table><br />';
 }
echo '</center>';
?> 

i have this code, the problem is th开发者_高级运维at when i try to modify one data all o them will be the same as the modified! here is the modify file:

<?php
$connection = @mysql_connect(localhost, 'root', '');
if (!$connection){
  echo 'not connect';
}
mysql_select_db('bena');

//Update content
$content = $_POST['content'];
$sql = "UPDATE activites SET content = '$content'";

$result = mysql_query( $sql, $connection );
if($result)
echo "Update was successfully complete! ";

?>


The query UPDATE activites SET content = '$content' needs a WHERE statement, which describes what objects that should be updated

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号