Jump to content
php.lv forumi

Negrib izlabot


homers

Recommended Posts

<?php
mysql_connect("localhost","root","");
mysql_select_db("bba");
$koments = $_POST['koments'];
if(isset($_POST['edit'])){
echo "<font color=green>Izlabots!</font>";
mysql_query("UPDATE comments SET koments=$koments WHERE id=".$_GET['id']."");

}
?>

un forma:

<form action='' method='post'>

<input name="koments" type="text" value="<?php echo $kom; ?>">

<input name="edit" type="submit" value="labot">

</form>

Edited by homers
Link to comment
Share on other sites

<?php
mysql_connect("localhost","root","");
mysql_select_db("bba");
$koments = mysql_real_escape_string($_POST['koments']);
if(isset($_POST['edit'])){
$data = mysql_query("UPDATE comments SET koments='$koments' WHERE id='".$_GET['id']."'");
if(mysql_affected_rows($data)){
echo "Ieraksts tika mainīts";
}else{
echo "Nekas netika labots";
}
}
?>

Edited by briedis
Link to comment
Share on other sites

Nē bet lai rada pie komentarā, piemēram rekur man izvelk komentāru

<div><a href="?a=lietotajs&id='.$autora_id.'>$r['autors']"</a></div><div>$r['koments']</div>

Un tē kur izvelkt komentāru kaut kur malā rada Kā šīs komentārs ir labots tada datumā

Edited by homers
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...