Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Jul-30 19:17
I have a "users online" PHP script which I place on each page on my site, works great showing how many people hit each page recently. I added it to my PHPBB forums with no problem, but I have since switch to SMF (due to spamming problems) and it works but also gives an error, saying a table doesn't exist which isn't even in my script. I changed all $string values to something unique so that couldn't be it. My INCLUDE is at the bottom of the main forum script, so it can't be doing anything after it it called.
Error:
Database Error: Table 'dbname.smf_sessions' doesn't exist
File: ..path/forums/Sources/Load.php
Line: 2005
dbname is the name of my database for the users online sql base. Unfortunately I don't know what line 2005 is as I just use wordpad to write my scripts and run them on the server.
I did ask this in the SMF forums but nobody there helps
I tried EXEC but it didn't work. Any idea what I could do to just run it by itself after the main script is done? It doesn't share any info so INCLUDE isn't needed if there is another method. Thanks.
|
 |
SportsGuy
Staff
Joined: Aug 30, 2002
# Posts: 3600
|
Posted: 2007-Jul-30 19:24
Crap - I had a great response about going to SMF support forums to ask, then reread your post.
Make sure you try a couple of different sections there (I tend to only post in the main support area, not the sub-sections) as that main area sees more traffic.
I've also had to bump posts daily for a few days before getting a response, but this I attribute to summer/vacation/folks spending more time outdoors, etc.
Sorry I've got nothing direct to contribute to answer your question...
|
 |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Jul-30 21:06
Well, I only posted it here wondering if it's a SQL problem (tho worked fine in PHPBB) and if there is a way to call a PHP from another PHP script without sharing anything, without INCLUDing. I don't know everything about PHP and know nothing about SQL
|
 |
SportsGuy
Staff
Joined: Aug 30, 2002
# Posts: 3600
|
Posted: 2007-Jul-31 00:14
The only real advice I can offer comes from my own self-teachings:
Be VERY careful in the code in SMF - especially the new versions. If you misplace even so much as a semi-colon it'll die on you.
Other than that, I've still got my learner's permit for coding...
|
 |
Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788
|
Posted: 2007-Jul-31 06:10
I am not sure about your question. As I understand, your main script which has an include (calls an external file for further processing) fails due to a database error.
The easy way to isolate and test a module (in your case the offending include file Load.php) is to write another test script which includes the Load.php along with any other supporting files. You can test this directly from the browser like so: http://localhost/test.php
Alternatively go to your shell prompt and type
php test.php
|
 |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Jul-31 14:18
Thanks for the input. I don't have sql and everything locally so I have to test it on the server. Basically everything works fine until I include my little users online script at the end of the main forum file - it works but shows the above error after it's done, must be some SQL clash tho I don't understand how. If I could just RUN my PHP script and not INCLUDE it, it probably would work fine. I'm going to try VIRTUAL later, probably won't work.
|
 |
Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788
|
Posted: 2007-Aug-01 14:09
Including a file is the same as running it in the server. The file included is run in the server; You can still test the results from your server.
Instead of http://localhost/test.php you will have to address the script as [link]
|
 |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Aug-01 15:27
I know that What I meant is can I execute a PHP from within a PHP script but have it ignore the other PHP script? For some reason, and since I don't know SQL or PHP well enough to figure it out, my users online script and the forum script are clashing in the SQL area, but the $string names and SQL names are different. I have no clue. It worked fine in PHPBB, too bad it's a junk forum and the spammers love it. I kind of gave up on resolving it. I googled everything I can think of.
|
 |
Dinkar
Staff
Joined: Aug 12, 2001
# Posts: 4391
|
Posted: 2007-Aug-01 21:00
Error:
Database Error: Table 'dbname.smf_sessions' doesn't exist
File: ..path/forums/Sources/Load.php
Line: 2005
You are adding the script at the end of the file so I guess it get executed after some code that terminate or do somthing similar with the session database.
I don't know SMF so can't tell you the exact location to add your script but it should be somewhere before footer of your main script.
|
 |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Aug-01 22:35
Yeah, but smf_sessions shouldn't even be an issue as my script doesn't call it, that's what's weird. If my db name and variables aren't the same as smf's, it shouldn't matter where it goes. I assume you can have 2 db's open at the same time right? Besides, mine opens/closes/displays info before the error... I don't know. I know it's impossible for people to understand without seeing all the code but figured I'd ask
|
 |
langardmicro
Joined: Mar 12, 2007
# Posts: 76
|
Posted: 2007-Aug-02 01:07
Try absolute, hardwired paths to your includes. If you're trying to connect to two different databases simultaneously, that'll cause problems. Get the free version of NoteTabPro, load your script into it, take off the wordwrap and go to line whatever using the toolbar.
|
 |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Aug-02 13:14
I do use full paths.
If you can't connect to 2 db's at the same time, maybe that's the issue. But I did put the script at the very end of the main file so you'd think it would be closed. Thanks for the pointers.
|
 |
Dinkar
Staff
Joined: Aug 12, 2001
# Posts: 4391
|
Posted: 2007-Aug-02 13:54
I did put the script at the very end of the main file
Don't put the script at the very end of the main file. Put it before "footer" instructions that closes everything.
|
 |
david68
Joined: May 16, 2005
# Posts: 144
|
Posted: 2007-Aug-02 16:23
I'll look into that, thanks. If you ever looked at the source for forums you'd go crazy trying to find what you need. Complicated stuff. Like I said long ago, it worked without issue with PHPBB so SMF must not be closing it out where I thought it should have.
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|