I am trying to create a page where I can insert a new recod into a table. The table has 2 fields, id and news. I have a submission page (news_add.html) that has the form action for news_add.php. I cannot get the news in my form page into my db (it contains HTML code). I can get it to work with simple text (if i just enter "test" into my form field, that gets inserted as "value="test">". SO, it would seem that everything is wired properly, but for some reason I cannot insert html code. I am doing something wrong, how can I do it right? I will paste the code from the two pages below. Thank you very much.
--code from news_add.php-- <? include("dbinfoSite.inc.php"); mysql_connect(mysql,$username,$password); @mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO news VALUES ('','$news')"; mysql_query($query);
mysql_close(); ?>
_end pasting_
Sun Aug 17, 2003 10:54 pm
barand
Junior Member
Joined: Sat May 10, 2003 1:39 pm Posts: 37
Either
Code:
$query = "INSERT INTO news VALUES (NULL,'$news')";
or
Code:
$query = "INSERT INTO news (news) VALUES ('$news')";
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum