Can't execute SQL: INSERT INTO `hesk_kb_articles`

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Can't execute SQL: INSERT INTO `hesk_kb_articles`

Post by killcount »

Script URL:
Version of script: 2.0
Hosting company: localhost IIS
URL of phpinfo.php: localhost
URL of session_test.php: localhost
What terms did you try when SEARCHING for a solution: save article, hesk_kb_articles,

Write your message below:

# Can't execute SQL: INSERT INTO `hesk_kb_articles` (`catid`,`dt`,`author`,`subject`,`content`,`type`,`html`,`art_order`,`history`) VALUES ('1',NOW(),'2','Tester','texts goes here!','0','1','10','On 02-05-2009 15:30 submitted by Mark Sarpy (Mark Sarpy)
')

MySQL said:
Field 'rating' doesn't have a default value

Please notify webmaster at

Everytime i try to save article i get that error. im running PHP 5.2.8 and mySQL server 5.0 if that matters.
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Can you check in phpMyAdmin what table types you have? Is MyISAM or InnoDB or some other?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Post by killcount »

Sure.

hesk_attachments
hesk_categories
hesk_kb_articles
-id
-catid
-dt
-author
-subject
-content
-rating
-votes
-views
-type
-html
-art_order
-history
hesk_kb_categories
hesk_notes
hesk_replies
hesk_std_replies
hesk_tickets
hesk_users


Is it something Im doing wrong? :cry:
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

No, it's not something you are doing wrong I'm just trying to figure out why all these errors started.

Please go to your phpMyAdmin again and in the database structure (where all your tables in the database are listed) see what is says under "Type" for all your Hesk databases.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Post by killcount »

for type it says MyISAM.
i hope thats what your asking for.


Image
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

This should fix it:

Code: Select all

<?php 
define('IN_SCRIPT',1); 
define('HESK_PATH',''); 
require(HESK_PATH . 'hesk_settings.inc.php'); 
require(HESK_PATH . 'language/'.$hesk_settings['language'].'.inc.php'); 
require(HESK_PATH . 'inc/common.inc.php'); 
require(HESK_PATH . 'inc/database.inc.php'); 

hesk_dbConnect(); 

$sql = "ALTER TABLE `".$hesk_settings['db_pfix']."kb_articles` CHANGE `rating` `rating` FLOAT DEFAULT '0' "; 
hesk_dbQuery($sql); 
$sql = "ALTER TABLE `".$hesk_settings['db_pfix']."kb_articles` CHANGE `votes` `votes` MEDIUMINT(8) UNSIGNED  DEFAULT '0' "; 
hesk_dbQuery($sql); 
$sql = "ALTER TABLE `".$hesk_settings['db_pfix']."kb_articles` CHANGE `views` `views` MEDIUMINT(8) UNSIGNED  DEFAULT '0' "; 
hesk_dbQuery($sql); 
$sql = "ALTER TABLE `".$hesk_settings['db_pfix']."kb_articles` CHANGE `type` `type` ENUM('0','1','2') DEFAULT '0' "; 
hesk_dbQuery($sql); 
$sql = "ALTER TABLE `".$hesk_settings['db_pfix']."kb_articles` CHANGE `html` `html` ENUM('0','1') DEFAULT '0' "; 
hesk_dbQuery($sql); 
$sql = "ALTER TABLE `".$hesk_settings['db_pfix']."kb_articles` CHANGE `art_order` `art_order` SMALLINT(5) UNSIGNED  DEFAULT '0' "; 
hesk_dbQuery($sql); 

echo "Database modified"; 
?>
If you get any other errors you can post them here, no need to open a new topic.
Last edited by Klemen on Fri Feb 06, 2009 5:58 pm, edited 1 time in total.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Post by killcount »

Can't execute SQL: ALTER TABLE `hesk_kb_articles` CHANGE `history` `history` TEXT DEFAULT ''

MySQL said:
BLOB/TEXT column 'history' can't have a default value

Please notify webmaster at

whats what i got when i tryed to run the dbupdate.php.
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Try again, I modified the above code.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Post by killcount »

Thank you sir! :D
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Post by killcount »

i get Can't execute SQL: INSERT INTO `hesk_kb_categories` too.
Last edited by killcount on Thu Feb 12, 2009 8:35 pm, edited 1 time in total.
killcount
Posts: 12
Joined: Thu Feb 05, 2009 3:30 pm

Post by killcount »

i should of made a new topic :)
dbower
Posts: 10
Joined: Sat Jan 31, 2009 5:19 am

Can't execute SQL: INSERT INTO `hesk_kb_categories`

Post by dbower »

The above script fixed problem of adding a article but I still get the error when trying to add a new category


Can't execute SQL: INSERT INTO `hesk_kb_categories` (`name`,`parent`,`cat_order`,`type`) VALUES ('Software','1','20','0')

MySQL said:
Field 'articles' doesn't have a default value

Please notify webmaster at dbower@greenetweed.com
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Please try searching the forum:
viewtopic.php?t=2353
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply