User warning error messages when creating announcement
| Project: | Announcements |
| Version: | 5.x-1.0-alpha2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | NancyDru |
| Status: | closed |
Jump to:
Got the following when I created my initial announcement:
" user warning: Table 'garland_aa1main.announcements' doesn't exist query: SELECT n.nid FROM node n INNER JOIN announcements a ON n.nid = a.nid WHERE n.type='announcements' ORDER BY n.sticky DESC, A.publish_date DESC in /home/garland/public_html/includes/database.mysql.inc on line 172.
user warning: Table 'garland_aa1main.announcements' doesn't exist query: SELECT n.nid FROM node n JOIN announcements a USING(nid) WHERE n.type='announcements' AND n.status=1 AND a.publish_date < 1210105759 AND a.expiration_date > 1210105759 ORDER BY a.publish_date ASC LIMIT 0, 3 in /home/garland/public_html/includes/database.mysql.inc on line 172."
Have installed module, ran update php, configured block to show announcements, what do I need to do to take care of this warning.
Thanking you in advance for your help in this matter.
E G Pursley

#1
Did you get any errors during the install? This indicates that the table didn't get built. Do you have an "announcements" table in your database? Did you not have errors when you created the initial announcement?
#2
No errors during the install, no errors when I was configuring the the module or setting up the block. The reported error (above in my initial post) happen after the announcement (add content) page was refreshed after I clicked on the submit post button.
#3
Do you have an "announcements" (as opposed to "announcement") table in your database?
#4
I didn't notice this bug right away. The problem I think is in the install script. I filed a bug on it, but basically the install script uses "announcements" as opposed to "{announcements}" to define the table.
However upon playing with this, it appears that the .install file isn't even running for me. I can't get it to create any table period, and if I try to add some print statements to it to try to get some tracing of whats being executed I get no output.
#5
I committed a fix for the brackets (-dev).
The install code should only run once unless you uninstall. I've also had problems printing from the install code. Drupal_set_message works fine though.
Which PHP and MySql releases are you using?
#6
I uninstalled and re-installed the module and it installed fine for me.
#7
FYI - I am running MySQL 5.0.45 and PHP 5.2.5. Have reinstalled the latest version (alpha 4) still getting the error.
#8
If you did not uninstall (not just disable), the install code will not run. BTW, this will delete all existing announcements.
Do you have an "announcements" (as opposed to "announcement") table in your database?
Don't even bother trying to create an announcement until you check this.
#9
Hi again,
I checked to make sure that a table named "announcements" was in my database. I uninstalled the module and then reinstalled the module and got the following warning and the message stated that "TABLE installation" for the announcement module was unsuccessful:
"user warning: Table 'announcements' already exists query: CREATE TABLE announcements ( nid int(10) unsigned NOT NULL default '0', abstract varchar(255) default '', publish_date integer NOT NULL default '0', expiration_date integer NOT NULL default '0', PRIMARY KEY (nid)); in /home/garland/public_html/includes/database.mysql.inc on line 172.
Table installation for the Announcement module was unsuccessful."
What do I need to do next? I have created the announcements table with 4 fields as outlined in the IBM document - Building a custom module in Drupal, as well as trying it with just the nid (primary key) field. And got the same results - a warning.
Again, thanking you in advance.
EG
#10
Hi again,
OK, this time I deleted the table called announcements.
Then I uninstalled the announcement module. And, then I reinstalled the module again and let it create the table during installation and this time everything went fine and without any errors.
Set-up block and created an announcement and seems to work according to intent.
EG
#11
Great. I can only assume that this was because I originally had an error in the CREATE SQL. You did the right thing. I'm glad it's working now.
#12
Please let me know if you find anything else. There's already a request to create a 6.x version, but I want 5.x stable first.
#13