TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 468
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 80
  • Total: 80

phpbox throwing database error

Started by unrelenting, July 12, 2008, 01:35:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

unrelenting

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

JPDeni

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.

unrelenting

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.

JPDeni

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. :)

G6Cad

dats.smf_sessions

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

JPDeni

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.

unrelenting

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`.

This website is proudly hosted on Crocweb Cloud Website Hosting.