Page 1 of 1

CMS Error in content.php

Posted: Wed May 20, 2020 3:19 pm
by Bucky108
I get the following error:

PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ...

I have created the 3 tables manually in the MySQL application that I'm using and confirmed they were created successfully.

The error occurs on this line:

while ($data = mysqli_fetch_array($result))

Suggestions?

Re: CMS Error in content.php

Posted: Wed May 20, 2020 3:40 pm
by Pablo
There may be an error in the table structure.

Re: CMS Error in content.php

Posted: Wed May 20, 2020 3:49 pm
by Bucky108
I copied the create scripts from the help page. Do they need to get updated?

CREATE TABLE `CMS_PAGES` (
`id` int(10) unsigned NOT NULL auto_increment,
`category_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`content` text NOT NULL,
`home` tinyint(1) NOT NULL default '0',
`visible` tinyint(1) NOT NULL,
`create_date` timestamp NOT NULL,
`created_by` varchar(255) NOT NULL,
`last_update_date` timestamp NOT NULL default '0000-00-00 00:00:00',
`last_update_by` varchar(255) NOT NULL,
`views` int(11) NOT NULL,
`menu_index` smallint(4) NOT NULL,
`url` varchar(255) NULL,
`extra_data` varchar(255) NULL,
`title` VARCHAR(100),
`description` VARCHAR(255),
`keywords` VARCHAR(255),
`seo_friendly_url` VARCHAR(100),
PRIMARY KEY (`id`));

CREATE TABLE `CMS_SEARCH_WORDMATCH` (
`page_id` int(10) unsigned NOT NULL,
`word_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`page_id`,`word_id`));

CREATE TABLE `CMS_SEARCH_WORDS` (
`id` int(10) unsigned NOT NULL auto_increment,
`word` varchar(50) NOT NULL,
PRIMARY KEY (`id`)) ;

Re: CMS Error in content.php

Posted: Wed May 20, 2020 3:56 pm
by Pablo
The table structure is ok.
But did you use the correct MySQL settings?

Re: CMS Error in content.php

Posted: Wed May 20, 2020 7:16 pm
by Bucky108
Pablo I found the problem causing the error:

$sql = "SELECT id, parent_id, name, url FROM " . $mysql_table . "PAGES WHERE visible = 1 ORDER BY menu_index ASC";

There was no "parent_id" column in the table, created from the SQL as I listed it above.

When I added the column manually in the table it removed the error.

But now when I click on "Administrator" I cant add any records.

Is there something else that has to be done?

Re: CMS Error in content.php

Posted: Wed May 20, 2020 8:24 pm
by Pablo
Is there another error?

Re: CMS Error in content.php

Posted: Wed May 20, 2020 8:36 pm
by Bucky108
No other error it just shows:

The CMS Admin object allows you to add, edit or remove pages online.

And nothing else.

Re: CMS Error in content.php

Posted: Wed May 20, 2020 8:39 pm
by Pablo
What happens if you add a page?
Are there any error in the server log?

Re: CMS Error in content.php

Posted: Wed May 20, 2020 8:52 pm
by Bucky108
I added a page and re-published the site. No change.

No errors on server log.

Re: CMS Error in content.php

Posted: Wed May 20, 2020 8:58 pm
by Bucky108
By the way here is the web server configuration:

Web server
Microsoft-IIS/10.0
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $
PHP extension: mysqli Documentation curl Documentation mbstring Documentation
PHP version: 7.2.26

Re: CMS Error in content.php

Posted: Thu May 21, 2020 6:15 am
by Pablo
Did you enable PHP error reporting on the server?
If it does not work then there should be at least be a message about by it fails.

Re: CMS Error in content.php

Posted: Thu May 21, 2020 2:48 pm
by Bucky108
I'm using a hosting service and I don't see anywhere where you can capture PHP errors.

However I created my own error handler:
-------------------------------------------------
//error handler function
function customError($errno, $errstr) {
echo "<b>Error:</b> [$errno] $errstr";
}

//set error handler
set_error_handler("customError");
-------------------------------------------------

No errors reported. I created a copy of the page and forced an error, which the handler did pick up.

So I'm pretty sure there were no MySQL or PHP errors. In any case there is a lot of error checking in the script.

Is there a working sample of the demo so I can see what the screens look like when it is working correctly?

Re: CMS Error in content.php

Posted: Thu May 21, 2020 3:17 pm
by Bucky108
Pablo I found the problem. I had PHP set to 7 on the content page but not on the admin page.

Sorry for the run around I should have checked that right off the bat.

Re: CMS Error in content.php

Posted: Thu May 21, 2020 4:00 pm
by Bucky108
Next problem: I added a new page and clicked "Save" but the new page was not created. I added write permissions on the folder.

Should the name field have an extension, i.e. "test.htm"?

What is the format for the External URL field?

Should the Owner field be the name of the site admin?

Re: CMS Error in content.php

Posted: Thu May 21, 2020 5:02 pm
by Pablo
Pages are not saved to a folder. The content is are stored in the database. All content is accessed from one page (with a CMS view).

Here is a related tutorial:
http://wysiwygwebbuilder.com/cms_tools.html

Re: CMS Error in content.php

Posted: Fri May 22, 2020 7:25 pm
by Bucky108
OK thanks..got it working.