strange error
Posted: Wed Feb 19, 2003 8:58 am
Hi everybody, I have this code:
if $news_main is a bit bigger I always get "An error occured..." which means that insert into... didn't work. if $news_main is a bit smaller it works fine. the database entries are ok..news_main is defined as TEXT so this shouldn't be the error.
I also changed this line
into this:
and then I got the "wrong mysql_result_resource" error. so something must be wrong with news_main definately.
The strangest part is that this doesn't work since some days although I didn't change anything.
Any help greatly appreciated!
Code: Select all
// commands to insert news
if($action=="insert")
{
$news_main = remove_line_breaks($news_main);
$num_rows = mysql_num_rows(mysql_query("SELECT * FROM news_on_main_page WHERE news_header = '$news_header'"));
if($num_rows == "0")
{
$news_SQL_insert = "INSERT INTO news_on_main_page (news_sub_heading,news_header,news_datetime,news_main,news_author) VALUES ('$news_sub_heading','$news_header','$news_datetime','$news_main','$uname')";
$bool = mysql_query($news_SQL_insert);
if($bool == "1") echo "<SCRIPT LANGUAGE=JavaScript>window.alert('News successfully inserted into the main page!')</SCRIPT>";
else echo "<SCRIPT LANGUAGE=JavaScript>window.alert('An error occured while inserting the news into the main page!')</SCRIPT>";
}
else // of if num_rows
{
echo "<SCRIPT LANGUAGE=JavaScript>window.alert('News is already in the database!')</SCRIPT>";
}
} // of if actionI also changed this line
Code: Select all
$num_rows = mysql_num_rows(mysql_query("SELECT * FROM news_on_main_page WHERE news_header = '$news_header'"));Code: Select all
$num_rows = mysql_num_rows(mysql_query("SELECT * FROM news_on_main_page WHERE news_main = '$news_main'"));The strangest part is that this doesn't work since some days although I didn't change anything.
Any help greatly appreciated!