godsent Posted March 20, 2009 Share Posted March 20, 2009 I need your help everyone. I understand how this works. mysql_query("UPDATE list SET bans = bans+1 WHERE name ='$nick'"); And what im trying to do is: where is row called "comments", and I wan to add new comment in the same row with existing old comment. Its a comments for every user, and im not sure how to do that exactly. Any ideas please? Link to comment https://forums.phpfreaks.com/topic/150293-sql-problem-editing-with-existing-value-new-value/ Share on other sites More sharing options...
MasterACE14 Posted March 20, 2009 Share Posted March 20, 2009 do you mean... <?php $query = mysql_query("INSERT INTO `something` (comment) VALUES('".$comment."')") or die(mysql_error()); ? Regards, ACE Link to comment https://forums.phpfreaks.com/topic/150293-sql-problem-editing-with-existing-value-new-value/#findComment-789276 Share on other sites More sharing options...
godsent Posted March 20, 2009 Author Share Posted March 20, 2009 I mean to update the row with old value + new value. Link to comment https://forums.phpfreaks.com/topic/150293-sql-problem-editing-with-existing-value-new-value/#findComment-789337 Share on other sites More sharing options...
irkevin Posted March 20, 2009 Share Posted March 20, 2009 are you using a form for that? Link to comment https://forums.phpfreaks.com/topic/150293-sql-problem-editing-with-existing-value-new-value/#findComment-789342 Share on other sites More sharing options...
godsent Posted March 20, 2009 Author Share Posted March 20, 2009 yes simple form Link to comment https://forums.phpfreaks.com/topic/150293-sql-problem-editing-with-existing-value-new-value/#findComment-789353 Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 set a session then update the database with the new comment. <?php session_start(); // database connection. if(isset($_POST['submit'])){ $comment=mysql_real_escape_string($_POSt['comment']); $_SESSION['comment']=$comment; // insert info // if(mysql_affected_rows(the insert) // update database set comment=$_SESSIOn['comment'] WHERE id='$id' you get the drift i hope. Link to comment https://forums.phpfreaks.com/topic/150293-sql-problem-editing-with-existing-value-new-value/#findComment-789358 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.