hello,
i saw a bug report with no comments posted on the 19th. what does this mean, has anyone else had this problem and fixed it? when i go to post a forum topic i get the following error:

warning: sprintf(): Too few arguments in /home/..../drupal/includes/database.inc on line 147.

i also get:

user error: Query was empty
query: in /home/....drupal/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /home/..../drupal/includes/common.inc:385) in /home/..../drupal/includes/common.inc on line 193.

it seems as though the node is getting properly dropped off in the db (i looked and it is there). it just is not getting pulled back from the db. when i look on the site, the name of the forum post is there, but it is not a link and i cannot get to the actual post.

any ideas or help would be greatly appreciated...
thanks,
eva

Comments

eva’s picture

why am i getting the above errors? something to do with too many % signs? where? how do i figure out where the problem is to fix it?

i noticed that if i try and post a forum topic, the topic is given a number that has already been assigned to another node ("duplicate entry" errors) - why is it not being assigned its own node number? it's almost like it doesn't recognize that there are already almost 60 nodes that have already been created, so it's starting over again from 1...

please check it out at http://selfesteemcommunication.com/drupal/forums
thanks,
eva

robertdouglass’s picture

- Robert Douglass

-----
www.robshouse.net
www.webs4.com

eva’s picture

unfortunately,no. now, for some reason, none of my static pages are showing up even though they are in db. i need to see if i can figure out why that's happening... this is really frustrating...did you go to the site and try to post a topic? any ideas would be really helpful. i have no clue why i am having this problem...

i can go to the taxononomy term - for example, http://selfesteemcommunication.com/drupal/taxonomy/term/61

and it just says that "there are currently no posts in this category" - why is it now not being seen as a static page (this page is in the db and listed as a page)?

thanks,
eva

ps - if i look at the page source it says: taxonomy/term/52/0/feed

why is it adding on the /0/feed when it's just supposed to be a static page...

eva’s picture

turns out i downloaded version 4.6 by accident, and that is why i'm having all the error messages and the rss feed issues.

but so what are these dang sprintf() issues all about? anyone?

robertdouglass’s picture

Whenever you see that it almost surely means that a database query is being made where not enough parameters were given to satisfy all of the expected parts for string replacement. Here's an example:


db_query("SELECT * FROM {node} WHERE nid = %d AND uid = %d", 3);

This line of code will give you the type of error you're seeing. Two things happen behind the scenes before the query gets executed on your database. The first is the {node} gets replaced with db_prefix_node if you specified a database prefix or just node otherwise. Then the PHP function sprint_f is called on the query string. Look that function up on php.net to see what it does, but basically it looks for placeholders (%d, %s...) and replaces them with the parameters that were passed into the function. In the example above, I have two placeholders; %d and %d. I only have one parameter, however, 3. Thus the sprint_f error - too few parameters.

The fact that you have 4.6 and thought that you had 4.5.2 explains a lot about your error - you need to choose and unify your modules and the Drupal codebase or errors like the one you're having are to be expected.

- Robert Douglass

-----
www.robshouse.net
www.webs4.com

eva’s picture

Robert,

thank you very much for your explanation of "sprintf" and why i am getting the error - it makes sense to me. i am learning. there is just so much to learn!

all of the modules that i am currently using came packed with this version. i have no other modules set up or turned on for use. so, i don't think that there's any cross-version incompatibility happening.

i thought for sure that the error would be in forum.module since i get the grey banner error every time i preview a forum topic that i've submitted. when i submit the topic, i get additional "headers already sent" messages on a white screen. i might be missing the source of the error because my eyes are a little shot for the day, but i'm wondering if you might have any suggestions of where else i might look for the insufficient parameters...

thank you again,
Eva

robertdouglass’s picture

Eva,

the easiest way to get to your goal - making a website - will probably be to download a stable version (4.5.2) and re-install. The 4.6 RC is just a release candidate, mostly intended for developers and early adopters who have loads of Drupal experience. No doubt that you'll learn how to debug Drupal like a pro eventually, but it's probably more important to learn how to make great sites with it first.

Here's 4.5.2:
http://drupal.org/files/projects/drupal-4.5.2.tar.gz

- Robert Douglass

-----
www.robshouse.net
www.webs4.com

prahaladan’s picture

It happens when you dont give sufficient arguments for the placeholders in sprintf function. Explained here:
sprintf too few arguments

carlmcdade’s picture

I'll throw you a bone . I just went through something similar when I was trying to get the 4.6 book.module to work with 4.5.2. Some functions were missing and causing errors. Sometimes the error or warning message from PHP came up and caused a header error in another part of the script. Anytime PHP does a plain text message to screen any redirects or cookie headers cause a header errors after that.

You need to make sure that you ar not mixing 4.5.2 and 4.6 modules. Some work but some still don't and you will get a PHP error or warning message. Also if you are trying to upgrade a module make sure you get the right syntax.

4.5.2

db_query("SELECT * FROM {node} WHERE nid = %d AND uid = %d", 3);

4.6


$result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE n.nid = %d'), arg(1));

Also stay away from CVS versions while you are upgrading. Try and get a clean working upgrade from the stable versions first and then start using cvs items one by one.
---------------------------
Hivemindz CMSopedia
__________________________
Carl McDade
Information Technology Consult
Team Macromedia

eva’s picture

i've been away and unable to look, but i will scour away when i return...i noticed the different syntax and wondered if it served the same purpose as robert's example. let's hope (i hope) i can make something of the bone...regarding the cvs version - believe me it was not intentional, and i won't make that mistake again:)
thanks,
eva

eva’s picture

so, as is probably evident -something is very screwy. i remembered that when i upgraded to 4.6 i did not disable the added on modules that i was using. so, i am wondering if that omitted step created the mess i am in. if so, how do i fix? i went through the db and removed all the tables having anything to do with any of the add on modules so that now i'm just bareboned drupal.

i've found the sections with the above mentioned syntax, but i haven't been able to figure out which one might be missing the parameter that it needs - and if it was missing, i don't know what it should have...

at this point, i am figuring that i have created this situation by doing something in the actual upgrade, and that it's not really something that's problematic with the code since hardly anyone is encountering the same issue (although, at least one other person is having the same difficulty as me - http://drupal.org/node/19138).

if i go back to 4.5.2, i can get the forums to work just fine, but then the admin won't work at all, and i get a whole host of other problems. why does only the forum not work in 4.6, and then why is the forum the only node to NOT have problems in 4.5.2? bizarre. at this point, i'd be happy to go back to 4.5.2, but i don't seem to be able to go back...

...any more scraps? bones? anything?

thanks,
eva

carlmcdade’s picture

Not in the manual but you need to empty (truncate) the cache table several times during an upgrade. Things will go haywire because the cached menus and some other items will not be compatible with the upgraded version and disappear.

I don't know why Drupal does not have a big flush handle on the bottom of the administration menu. It is needed.
---------------------------
Hivemindz CMSopedia
__________________________
Carl McDade
Information Technology Consult
Team Macromedia

eva’s picture

carl, i followed your suggestion and truncated the cache table a few times. i'm still coming up with the same errors. any other ideas?
thanks,
eva

Steven’s picture

The cache table is already cleared when you perform updates through update.php.

--
If you have a problem, please search before posting a question.

carlmcdade’s picture

Yeah, that was my next question. Are you using the update script or doing this by hand?

You could always do a clean install in another directory and use myphpadmin to export and import. Being carful not to do any contributed modules until you have a stable environment. Then do the contribes one by one. I have done this a couple of times when I have had problems with an unknown module source.
---------------------------
Hivemindz CMSopedia
__________________________
Carl McDade
Information Technology Consult
Team Macromedia

eva’s picture

i tried both - first the update.php script then emptying the cache table...am still plugging away...

the crazy thing is that i have absolutely NO added modules - all i have is what comes packed with the 4.6 version. it seems like from the comments i've read that this error only seems to come up when there are modules not yet compatible with 4.6 being asked to work with 4.6 - but i have none, so it doesn't make sense to me. unless, of course, my not disabling the modules that i did have before upgrading to 4.6 is somehow having an effect (is that possible even though i deleted any added-extra modules from the db??)...

eva’s picture

so, i haven't really solved anything, but i am getting closer to what i want...a working website. anyway, i just reinstalled the newest version of 4.6 in a different directory to test it and set up a new database. after all the time i've spent, it's just worth to start over. there may be other issues i'll encounter, but at least the forums now work. thank you carl and robert.

update: i realized what contributed to the problem i had. first, i did not turn off all extra modules that i had running BEFORE upgrading to 4.6. i don't know if that did it - but it probably did not help.

Re-installing did not work until I went through the entire database and made sure that I had NO extra tables beyond the exact same ones that come with 4.6 upgrade.

In other words, if you have the same error i got, you need to delete the tables in your database that do not match the same ones that come with the download (i think there are 55 tables total). Make sure you have the right number. OK - nuff preaching - just hope it helps someone else figure it out faster than me...
eva

noid’s picture

See this: Free-tagging broken on forums -- http://drupal.org/node/28607. Disabled free-tagging for forum topics and the error disappeared.

robertdouglass’s picture

Free tagging wasn't in either 4.5 or 4.6

- Robert Douglass

-----
My sites: HornRoller.com, RobsHouse.net

noid’s picture

Hi Robert,

Actually you can backport free-tagging to 4.6. Just in case she did that. :)

And posted my reply too for the benefit of those who did backport free-tagging, had problems with the forums, and found this thread looking for a solution. The solution I previously linked to couldn't easily be found -- found it by way of Google, and then Bryght. :)