Prefix Problem

Having trouble installing AmpJuke ?
Check this.

Prefix Problem

Postby chs on 31-12-2007 13:16

I installed AmpJuke and confirmed the standard prefix "ampjuke_"

All tables where created correctly and it seemed to work.
Have had no music uploaded so far.

After relogin and adjusting some settings NO Select could be executed anymore. Even login failed with error message like 'User not found in user table - installed AmpJuke correctly ?'

Playing around I found out that the prefix was not been used and so all selects fail.
Looks now like this:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/web375/html/fcgn/download/sql.php on line 44

Question: Where should have the prefix variable been saved ? I can't find it.
I added manual to db.php, but did not help.

Thanks
CHS
User avatar
chs
Newbie
Newbie
 
Posts: 2
Joined: 31-12-2007 13:08

Postby Michael on 31-12-2007 15:27

Hi chs,

Welcome to the AmpJuke forum and thanks for posting.

To answer you last question first:
The setting/variable for the prefix is stored - as you mention - in "db.php".

The variable to look for within "db.php" is: $ampjuke_tbl_prefix.
It looks like this (when using the standard prefix "ampjuke_" like you did):
Code: Select all
$ampjuke_tbl_prefix="ampjuke_";


So - my suggestion is to check/verify the "db.php" file to see that $ampjuke_tbl_prefix is set according to what you want.


Apart from that, and if the above doesn't help: Can you perhaps be more specific about what you did before/during/after "adjusting some settings"...?

For your information, I just downloaded AmpJuke, installed by following the installation example, and have finally just scanned+imported approx. 5500 tracks to the database (and is listening to Alison Moyet's voice from her "Yazoo period" right now).
I have changed some personal settings (incl. the password), logged out/in a couple of times, and everything still works as expected.


Some background information:
When introducing prefixes for tables, I took the "lazy" approach.
Rather than inspecting/modifying each and every SQL-statement (there are many!) in AmpJuke, I modified the "wrapper" that does the actual SQL-processing - since it's only located in one place.
To see what I mean, you might open "sql.php" and find the line starting with:
Code: Select all
if ((isset($ampjuke_tbl_prefix))) {

The lines of code after the above mentioned are expected to "catch" and obviously modify all SQL-statements, if $ampjuke_tbl_prefix is set (which it is, if it's present in "db.php").
The "catch" and modify stuff will - of course - have a small impact on performance...


Anyway, I hope some of this helps to clarify things and get your music collection online.
If not, please do not hesitate to update this thread (you're of course also more than welcome to update it if you succeed in getting the d*mned thing up&running :wink: )

Happy New Year !

//Michael.

P.S. If/when you respond later today, I might not be able to read it (literally...) until sometime tomorrow.
User avatar
Michael
Site Admin
Site Admin
 
Posts: 449
Joined: 03-07-2007 13:46
Location: Denmark

Prefix Problem

Postby chs on 31-12-2007 15:50

Thanks Micheal for your quick response.

I was able to reproduce the problem.
First it was neccessary the delete the db.php completely because I did not have access rights via FTP since the file is created in the 'web-world'.

Anyhow. I changed it and it did work.
Then you go as admin to Configuration and just save. No changes neccessary. And voila you hav the db.php without the prefix again.

Hope that helps to follow up.

If you need more info, please let me know.
User avatar
chs
Newbie
Newbie
 
Posts: 2
Joined: 31-12-2007 13:08

Postby Michael on 31-12-2007 16:53

Hello chs,

Wow, - $ampjuke_tbl_prefix really disappears :shock:

Thank you !
Both for the quick response as well as the great error description (which I - unfortunately - was able to re-create right away...).

This will be corrected in the next version (0.7.0).
Seems like 0.7.0 is going to be released as one of the first things in 2008...after appropriate testing, of course.

Now, for a workaround, here's what should be done:
1. Edit "scan.php".

2. Locate the following lines of code within "scan.php".
It's around line 585 you should look:
Code: Select all
   echo '<tr><td>Database name:</td>';
   echo '<td><input type="text" name="db_name" class="tfield" value="';
   echo get_configuration("db_name").'" size="40">';
   echo '</td></tr>';

   if (file_exists("db_new.sql")) {


3. Right after the '</td></tr>'-stuff, insert this:
Code: Select all
   // Insert this, in order to AVOID the prefix-setting gets lost after editing
   // and saving the configuration:
   if ((!file_exists("db_new.sql")) && (get_configuration("ampjuke_tbl_prefix")<>'')) {
      echo '<input type="hidden" name="ampjuke_tbl_prefix" value="';
      echo get_configuration("ampjuke_tbl_prefix").'">';
   }   


4. With step 2 and 3 above merged together, the "patched" version of "scan.php" from line 585 (approx.) and forward will look like this:
Code: Select all
   echo '<tr><td>Database name:</td>';
   echo '<td><input type="text" name="db_name" class="tfield" value="';
   echo get_configuration("db_name").'" size="40">';
   echo '</td></tr>';

   // Insert this, in order to AVOID the prefix-setting gets lost after editing
   // and saving the configuration:
   if ((!file_exists("db_new.sql")) && (get_configuration("ampjuke_tbl_prefix")<>'')) {
      echo '<input type="hidden" name="ampjuke_tbl_prefix" value="';
      echo get_configuration("ampjuke_tbl_prefix").'">';
   }   

   if (file_exists("db_new.sql")) {


5. Save "scan.php", and you should be back in business.

Sorry for the inconvenience.
As mentioned, it will be corrected in 0.7.0.

Thanks again for your time to report and describe this.

//Michael.

P.S. I'll try again: Happy New Year :wink:
User avatar
Michael
Site Admin
Site Admin
 
Posts: 449
Joined: 03-07-2007 13:46
Location: Denmark


Return to Installation / support

Who is online

Users browsing this forum: No registered users and 0 guests

cron