I've been working on a script for quite some time now, particulary a site
news script. Heres how it works
1. Information is passed from a form to the database
2. Table is selected to a page to be viewed by the general public.
The problem is, when I use the form, there are no errors in the script,
but nothing is entered into the database.
Here are my scripts
------------------------------------The
Query------------------------------------
CREATE TABLE SiteNews
(
Alias varchar(50) NOT NULL default '0',
News BLOB NOT NULL,
NewsDate Date NOT NULL
) TYPE=MyISAM
-------------------------------------------------------------------------
---------
------------------------------------form
action------------------------------------
<?php
include ('config.php');
$link = @mysql_pconnect($location, $username, $password)
or die("Could not connect to the databaseserver. Please go back and
try again or try again later.");
@mysql_select_db($database, $link)
or die ("Could not select database. Please go back and try again or
try again later.");
$sql_insert = "INSERT INTO SiteNews ('Alias','News','NewsDate')
VALUES ('". addslashes($_POST['newsperson']) . "','" . $_POST['date'] .
"','" . addslashes($_POST['thenews']) . "')";
$result = mysql_query($sql_insert, $link);
echo (mysql_affected_rows($link) . " News entry inserted");
?>
-------------------------------------------------------------------------
-------------
------------------------------------Viewing the news
script---------------------------
<?php
include ('config.php');
$link = @mysql_pconnect($location, $username, $password)
or die("Could not connect to the databaseserver. Please go back and
try again or try again later.");
@mysql_select_db($database,$link)
or die ("Could not select database. Please go back and try again or
try again later.");
$sql = "SELECT Alias, NewsDate, News FROM SiteNews ORDER BY NewsDate
DESC";
$news = mysql_query($sql,$link) or die(mysql_error().'<p>'.$sql.'</p>');
if ($news){
if (mysql_num_rows($news)== 0){
echo ("No newsitems found.");
}
else{
while ($row = mysql_fetch_assoc($news)){
echo("<p>");
echo($row['Alias']. "<br />");
echo($row['NewsDate']."<br />");
echo($row['News']);
echo("</p>");
echo("<hr />");
}
}
}
else{
echo("Queryproblem");
}
?>
-------------------------------------------------------------------------
-------------
Can anyone see what is wrong??
Thanks