Menu ▾ ▴

#8 wp2pdf selects wrong database

open
nobody
None
5
2005-11-18
2005-11-18
No

I have wp 1.52 and wp2pdf 0.42 installed, it worked
well but suddenly wp2pdf showed an error - table
[wrong_database].wp_wp2pdf does not exist. the
wp2pdf-tables in the wordpress database were ok -
wp2pdf just tried to select a wrong database.

my solution was: adding the following lines after
"require_once('../wp-config.php');" to every file in
/wp2pdf where a db connection is made.

$dbconn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_NAME, $dbconn);

This takes the constants from wp-config.php

Then you need to alter every mysql_query($query)
command to mysql_query($query,$dbconn)

It works perfect now.

The reason for this behaviour may be - there is a web
app in the same virtual host which uses a different
database.

Discussion


Log in to post a comment.