So I upgraded, and... (*new question*)

Started by Dejana Talis, October 03, 2005, 08:31:30 AM

Previous topic - Next topic

Dejana Talis

I'm not sure if anyone will be able to help me with this, but it's worth a try.

I was getting some messages that my board and my database were different versions and I needed to update my database. So I did the update to SMF 1.1 RC1 because that's the only update I saw for the board version I was using (1.1.5 I believe?). It seemed to go okay, and the problems I had been seeing are now fixed, however...

I had created several original files to handle extra functions I had added to the site, using the same database. These worked fine on the old version, but now none of my queries will work, not even the simplest things! For example, in one of my files I have:


<?php 

$ssi_layers 
= array('main');
$forum_version 'SMF 1.0.3';
require(
"/mysite/board/SSI.php"); 

?>


<html>
<title>.moon - the living fandom</title>
<body>
<center>
<img src='http://www.dotmoon.net/administration.gif'>
<br>

<?php 

$query 
"SELECT memberName FROM smf_members
WHERE ID_MEMBER=
$ID_MEMBER";
$result mysql_query($query)
or die ("Couldn't execute query.");


The purpose to this is to get the member name of the person viewing the site. This worked fine on the old version of the site, but now I get "Couldn't execute query" every time and for the life of me I can't figure out why!

Oddly, I have a block of similar code that I inserted into Profile.php as a modification, and that is working fine. All I can think of is that there was an extra security measure or something added that now requires something additional be included in the files in order for the database connection to work, and my original files do not have that piece, while the SMF files like Profile.php do. I do not even know where to begin looking for something like that.

Can anyone help me?

Ben_S

You need to give the db prefix with SSI in 1.1.
Liverpool FC Forum with 14 million+ posts.

Dejana Talis

I'm afraid I'm not sure what you mean... A lot of what I've managed to make work has been partly luck, I'm ashamed to admit. I feel stupid asking you to explain further but with the search down I can't look for more details myself. Do you mean an extra line of code, or a modification to the queries, something like that? Thanks for the help.

Ben_S

Oops you are already using the prefix, try adding the database name

$query = "SELECT memberName FROM DBNAME.smf_members
   WHERE ID_MEMBER=$ID_MEMBER";
$result = mysql_query($query)
   or die ("Couldn't execute query.");
Liverpool FC Forum with 14 million+ posts.

Dejana Talis

That did the trick! Thank you so much!!!  :D

Now to go through and edit every query in my original files...  :'( Ah well, at least it will work again. Thanks again.  :)

Dejana Talis

Ugh. I have a lot of queries in a lot of files. Is there any easier way to do this? The query I added to Profile.php doesn't require the db prefix, what does that file have that my original files don't?

Ben_S

Only files using SSI.php require it, main SMF files don't.

Can you do a search and replace using a decent text editor

Eg, fine smf_ replace DBNAME.smf_
Liverpool FC Forum with 14 million+ posts.

Dejana Talis

Unfortunately I've added some new tables as well so they don't all start with smf_.

It's all right, though, I went through and edited all the files last night and now everything is working again.

Ben_S

Liverpool FC Forum with 14 million+ posts.

Advertisement: