I’m new in PHP I need to put on my site form which would allow add some content to database. It have to be like simple guestbook but I want to it not add new records to database but replace those which already exist. In other words: I want to in database could be only 1 record (last submitted).
Those are my codes:
myTEXT varchar(65) NOT NULL default ‘’,
PRIMARY KEY (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;[/php]
[php]$host=“bla bla bla”;
$username=“bla bla bla”;
$password=“bla bla bla”;
$db_name=“bla bla bla”;
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect server “);
mysql_select_db(”$db_name”)or die(“cannot select DB”);
$sql=“INSERT INTO $tbl_name(myTEXT)VALUES(’$myTEXT’)”;
It working but adding another records to database. I tried replace INSERT by UPDATE but I’m getting error. Could someone help me create working code, please?