TinyPortal

Development => Support => Topic started by: unrelenting on July 12, 2008, 01:35:18 AM

Title: phpbox throwing database error
Post by: unrelenting on July 12, 2008, 01:35:18 AM
I'm trying to read data from a separate database on my server other than the one that SMF uses. I do the regular:

require 'connect.php';
mysql_select_db("dats", $con);

$getdata_sql = 'SELECT * FROM routes WHERE distance >= 300 ORDER BY permile desc LIMIT 10';
$getdata= mysql_query($getdata_sql);

echo '

<table width="200">
<thead>
<tr>



It seems as if it is working fine in Firefox but IE just dies, It won't even load the forum up if the phpbox is viewable.

When I look at the markup validation it shows the errors after the </body></html> tags like this:

Error  Line 342, Column 14: character data is not allowed here.

</body></html>Database Error: Table 'dats.smf_sessions' doesn't exist<br



and

Error  Line 342, Column 82: document type does not allow element "br" here.

…news.smf_sessions' doesn't exist<br />File: /home/mine/public_html/board/S


and finally:

Line 342, Column 142: document type does not allow element "br" here.

…blic_html/board/Sources/Load.php<br />Line: 2017

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:




Are there some guidelines for using phpbox with data queries form different databases?

I'm running SMF 1.1.5 and TP v 0.9.8
Title: Re: phpbox throwing database error
Post by: JPDeni on July 12, 2008, 02:41:49 AM
I think the key is in the line

QuoteDatabase Error: Table 'dats.smf_sessions' doesn't exist

It's trying to find smf tables in your outside database. That's not going to work.

Is it possible for you to move the tables from the "dats" database into the smf database or do they have to be in a separate database? That would be the best thing to do. Then you wouldn't have to worry about connecting to the database at all, but could just write the queries that you need.
Title: Re: phpbox throwing database error
Post by: unrelenting on July 12, 2008, 03:31:32 AM
It's possible. I just don't like adding to that already monstrous table if I can get around it.

I'll wait a little while and see if anyone else has an idea of a way to make it work or if anyone has encountered this and got it to work.

Thanks for the suggestion.
Title: Re: phpbox throwing database error
Post by: JPDeni on July 12, 2008, 04:50:30 AM
I could be wrong, but I think you can only have one database open at once. It might be possible to use your code if you open the smf database again after you get your data from the "dats" database. I wouldn't be able to tell you how to do it, though. :)
Title: Re: phpbox throwing database error
Post by: G6Cad on July 12, 2008, 08:29:28 AM
dats.smf_sessions

dats   Is that your DB prefix you are using in your database ?
Title: Re: phpbox throwing database error
Post by: JPDeni on July 12, 2008, 02:24:47 PM
G6, that's a separate database that he's using for something else. He's trying to incorporate data from an external database into his SMF/TP installation.
Title: Re: phpbox throwing database error
Post by: unrelenting on July 12, 2008, 02:28:17 PM
Quote from: G6 on July 12, 2008, 08:29:28 AM
dats.smf_sessions

dats   Is that your DB prefix you are using in your database ?

No, that's just the name of the database that I store all of that particular data that I am trying to display. It's the actual name. I assume what I am trying to do is to keep it from looking for that dats.smf_sessions table.

My SMF database is called `forum`.