problem with creating new article and structure level

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

problem with creating new article and structure level

Post by Pieter »

I recently upgraded my 1.1RC4 release to 1.2.5-DEV. Everything seemed to work fine, until I tried to add a new article. This resulted in the following error:

Code: Select all

error while connecting to database:
INSERT INTO phpwcms_article (article_cid, article_uid, article_username, article_title, article_keyword, article_public, article_aktiv, article_begin, article_end, article_subtitle, article_redirect, article_sort, article_notitle, article_created, article_cache, article_nosearch, article_nositemap, article_aliasid, article_headerdata, article_morelink) VALUES ('33','1','Pieter van der Spek','test','','0','1','2005-10-09 17:45:45','2010-12-31 23:59:59','','', 0,0, '1128872745', '', '', 1, 0, 0, 1);
I can edit existing articles just fine, so it can't be a database setting.
I checked if the database table included all the fields mentioned above and it did so that can't be the problem either.

------------------
A problem also occurs while creating a new structure level. However, in this case I only get a blank screen with one word: "error".
-----------------

I bundled these two problems as I suspect they have the same cause. However, I'm at a loss as to what the problem might be. I hope someone can help me.
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

did yuo run the database updates?
http://www.studmed.dk Portal for doctors and medical students in Denmark
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

frold wrote:did yuo run the database updates?
Of course I did
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

Pieter wrote:
frold wrote:did yuo run the database updates?
Of course I did
and the config.php settings are correct?
http://www.studmed.dk Portal for doctors and medical students in Denmark
Pappnase

Post by Pappnase »

hallo

it looks like you DON NOT execute ALL database upgrades! :-(
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

frold wrote:and the config.php settings are correct?
Well, I cannot be sure of course, but I haven't changed anything after the upgrade.
Pappnase wrote:it looks like you DON NOT execute ALL database upgrades!
I thought of that, but the schema from my database looks pretty much the same as the script for 1.2.5-DEV. The only difference is that my database has some extra tables, which were probably usefull for the old version but not for the new. Anyway, having extra tables cannot be the problem.
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

I've tried to run the same query as above from within phpMyAdmin.
This doesn't pose any problems. This getting stranger by the minute. Does anyone have a clue why I can run the query from phpMyAdmin, but phpWCMS fails?
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

had a same Problem one time - some Files was not overwritten by the new Version. So my clue was to delete all *.php Files and upload them all again.
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

pico wrote:had a same Problem one time - some Files was not overwritten by the new Version. So my clue was to delete all *.php Files and upload them all again.
Sorry for my late reaction but I did not have much spare time.

Anyway, thanks for you answer but this (i.e. uploading all files again) doesn't solve it.
I also tried to create a fresh phpWCMS installation but that doesn't work either. That is, I get a message that the phpWCMS installer is unable to create the database.
So next I tried to execute the phpwcms_init.sql from within phpMyAdmin. This works flawlessly. I then imported the data from the existing database and pointed the exisiting installation to the new database. And still I cannot add a new article or a new category.

I'm really getting desperate now. I even tried to install another CMS (Mambo) but I'm unable to install that CMS too. Here it also goes wrong while trying to initialize the database.
Pappnase

Post by Pappnase »

hello

if you had such problems i would please you to contact your host maybe they have an problem with the server.
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

Pappnase wrote:if you had such problems i would please you to contact your host maybe they have an problem with the server.
I agree. It almost seems like there is a 'security' policy in place that allows me to do UPDATE and SELECT, but not INSERT. Strange thing is that there are no problems whatsoever when using phpMyAdmin, so it isn't something that was put in place to target malicious php-scripts in general.
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

A quick update. I reverted to 1.1RC4 (was not as difficult as I expected) and now everything works fine again.
Very strange. Did anything change in the code for contacting the database that might cause trouble?
ourpobox
Posts: 54
Joined: Wed 2. Jun 2004, 16:41
Location: Virginia, USA
Contact:

Post by ourpobox »

Hello Pieter,

Have you upgraded and not had this error since your last post? I just did a fresh install of 1.2.6 and I am having the very same errors you mentioned! Any clues?

Thanks

Greg
Pieter
Posts: 54
Joined: Sat 20. Mar 2004, 18:08

Post by Pieter »

ourpobox wrote:Hello Pieter,

Have you upgraded and not had this error since your last post? I just did a fresh install of 1.2.6 and I am having the very same errors you mentioned! Any clues?

Thanks

Greg
No, I'm still running 1.1.
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

This sounds like it could be related to the Article Starting and Ending Dates! Sometimes the host server is in a different timezone than you and the defaults are not yet realized (in that time zone). Make the YYYY-MM-DD HH:MM:SS a definite Start date and time that has already passed.

OR

Maybe CACHE is the problem?

Things happen at the end of this code in "article.new.tmpl.php":
Look for the line:
$sql = "INSERT INTO ".DB_PREPEND."phpwcms_article (".

Code: Select all

//Auswerten der neuen Artikeldaten
$article_cid = isset($_GET["struct"]) ? intval($_GET["struct"]) : 0;

$article_aktiv  = 1;
$article_public = 1;
$article_timeout = '';
$article_nosearch = '';
$article_title = '';
$article_subtitle = '';
$article_notitle = 0;
$set_begin = 0;
$set_end = 0;
$article_begin = '';
$article_end = '';
$article_redirect = '';
$article_keyword = '';
$article_nositemap = 1;
$article_aliasid = 0;
$article_headerdata = 0;
$article_morelink = 1;
			
if(isset($_POST["article_aktion"]) && intval($_POST["article_aktion"])) {
	$article_cid		= intval($_POST["article_cid"]);
	$article_title		= clean_slweg($_POST["article_title"]);
	$article_keyword	= clean_slweg($_POST["article_keyword"]);
	$article_aktiv		= isset($_POST["article_aktiv"]) ? 1 : 0;
	$article_notitle	= isset($_POST["article_notitle"]) ? 1 : 0;
	$article_public		= isset($_POST["article_public"]) ? 1 : 0;
	$article_hidesummary= isset($_POST["article_hidesummary"]) ? 1 : 0;
	$article_begin		= clean_slweg($_POST["article_begin"]);
	$article_end		= clean_slweg($_POST["article_end"]);
	$article_subtitle	= clean_slweg($_POST["article_subtitle"]);
	$article_redirect	= clean_slweg($_POST["article_redirect"]);
	$article_nosearch	= isset($_POST['article_nosearch']) ? '1' : '';
	$article_nositemap	= isset($_POST['article_nositemap']) ? 1 : 0;
	$set_begin			= isset($_POST["set_begin"]) ? 1 : 0;
	$set_end			= isset($_POST["set_end"]) ? 1 : 0;
	$article_aliasid	= intval($_POST["article_aliasid"]);
	$article_headerdata	= isset($_POST["article_headerdata"]) ? 1 : 0;
	$article_morelink	= isset($_POST["article_morelink"]) ? 1 : 0;
	
	if(isEmpty($article_title)) $article_err = "> ".$BL['be_article_err1']."\n";
	if($article_begin) { //Check date
		$article_begin = strtotime($article_begin);
		if($article_begin == -1) {
			$article_begin = date("Y-m-d H:i:s");
			$set_begin = 1;
			$article_err  .= "> ".$BL['be_article_err2']."\n"; 
		} else {
			$article_begin = date("Y-m-d H:i:s", $article_begin);
			$set_begin = 1;
		}
	} else {
		$article_begin=date("Y-m-d H:i:s");
		$set_begin = 0;
	}
	if($article_end) { //Check date
		$article_end = strtotime($article_end);
		if($article_end == -1) {
			$article_end = date("Y-m-d H:i:s");
			$set_end = 1;
			$article_err  .= "> ".$BL['be_article_err3']."\n"; 
		} else {
			$article_end = date("Y-m-d H:i:s", $article_end);
			$set_end = 1;
		}
	} else {
		$article_end="2010-12-31 23:59:59";
		$set_end = 0;
	}	//Ende Check Date
	
	$article_timeout = clean_slweg($_POST["article_timeout"]);
	if(isset($_POST['article_cacheoff']) && intval($_POST['article_cacheoff'])) $article_timeout = '0'; //check if cache = Off
	
	if(isEmpty($article_err)) {
		$sql =	"INSERT INTO ".DB_PREPEND."phpwcms_article (".
				"article_cid, article_uid, article_username, article_title, ".
				"article_keyword, article_public, article_aktiv, article_begin, ".
				"article_end, article_subtitle, article_redirect, ".
				"article_sort, article_notitle, article_created, article_cache, ".
				"article_nosearch, article_nositemap, article_aliasid, article_headerdata, article_morelink) VALUES ('".
				$article_cid."','".
				$_SESSION["wcs_user_id"]."','".
				$_SESSION["wcs_user_name"]."','".
				aporeplace($article_title)."','".
				aporeplace($article_keyword)."','".
				$article_public."','".
				$article_aktiv."','".
				$article_begin."','".
				$article_end."','".
				aporeplace($article_subtitle)."','".
				aporeplace($article_redirect)."', ".
				"0,".$article_notitle.", '".time()."', '".$article_timeout."', '".
				$article_nosearch."', ".$article_nositemap.", ".$article_aliasid.", ".
				$article_headerdata.", ".$article_morelink.");";
		if($result = mysql_query($sql, $db) or die("error while connecting to database: <br><pre>".$sql."</pre>")) {
			$article_id = mysql_insert_id($db);
			header("Location: ".PHPWCMS_URL."phpwcms.php?do=articles&p=2&s=1&aktion=1&id=".$article_id);
			exit();
		}
	}			
}	
		
?>
Post Reply