By k2gn on
What's the going rate for assistance with a DB?
Summary - Converted from 6.12 to 7.12. Worked well under 6.12 Getting errors in 7.12.
Using two DBs, php, MySQL.
email to larry at k2gn dot com
Thanks Larry
What's the going rate for assistance with a DB?
Summary - Converted from 6.12 to 7.12. Worked well under 6.12 Getting errors in 7.12.
Using two DBs, php, MySQL.
email to larry at k2gn dot com
Thanks Larry
Comments
What errors
Larry - it may not be the database at all. Could you be any more specific as to the errors you're getting.
This signature is currently blank
Hello James: I'm almost
Hello James:
I'm almost positive its iin the php/MySQL interface.
My settings.php is setup as per examples all over the DRupal site.
I am getting the following errors:
Notice: Use of undefined constant db_set_active - assumed 'db_set_active'
in eval() (line 4 of /home/k2gnncom/public_html/k2gn1/modules/php/php.module(80)
: eval()'d code).
Warning: mysql_query() [function.mysql-query]:
Access denied for user 'nobody'@'localhost'
(using password: NO) in eval() (line 9
of /home/k2gnncom/public_html/k2gn1/modules/php/php.module(80) : eval()'d code).
Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in eval() (line 9
of /home/k2gnncom/public_html/k2gn1/modules/php/php.module(80) : eval()'d code).
Notice: Use of undefined constant result - assumed 'result' in eval() (line 10
of /home/k2gnncom/public_html/k2gn1/modules/php/php.module(80) : eval()'d code).
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in eval()
(line 20 of /home/k2gnncom/public_html/k2gn1/modules/php/php.module(80)
: eval()'d code).
If you can view pages like
If you can view pages like /admin and /user, without errors, then your settings.php is at least partially correct.
Looks like you have some custom code being evaluated by the PHP filter that hasn't been updated. Since we can see that the code being eval()'d is directly using PHP functions like mysql_query, and mysql_fetch_array, rather than the Drupal database API functions, then it may not even be aware of your settings.php. These are the basic functions you'd use to access MySQL without the Drupal API.
You need to track down any code being eval()'d and review it for necessary updates. Possibly pages or blocks with custom functionality where the errors occur? Try turning off the PHP filter temporarily on a copy of your site and see if raw PHP code appears in the source of any of your pages, or if the errors disappear. If this doesn't help, you can get in touch via contact form...
http://www.trailheadinteractive.com
db_set_active does not work for PHP filter
[EDIT to clarify]: Testing shows on Drupal 7 db_set_active does not work for code interpreted by php filter, whether or not the code includes database queries. After switching to a non-Drupal database, php which is content in the default database fails to be either read or themed (I am not yet sure which) by the Drupal site which depends on the default database to work, as that database is set to inactive. The php must be in code, if it is using this function. Either the code fails to switch database because it is not D7-adapted, and throws errors as it did on the page linked above, or the code switches database correctly, but fails to be either read or themed from the now-inactive default database, and returns no output. Drupal 7 does not allow two database connections to be active concurrently. The only oustanding question is whether switching databases causes a failure to read the php from the default database, or a failure to theme it, but that is purely theoretical. The bottom line is that it does not work. The workaround is putting mysql_connect into the code instead. This works, but of course is the hacky solution, the code ideally should be a in a custom module.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Problem Solved
I want to thank John_b for working with me on resolving my issues.
Also, thank you to all who responded to my messages.
To criznach - I love the theme on http://www.trailheadinteractive.com/
In my experience you've
In my experience you've always needed to set the active db back to default when you're finished with the other database. Does that not work in the PHP filter?
http://www.trailheadinteractive.com
No, tried that. If you just
No, tried that. If you just do
(and set up 'new_database' in settings.php and make sure it exists with proper creditials), "Hello World" fails to print, even though it works without the set_db_active function in the script. If you happen to try it, and find it works for you, let me know!
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
This worked for me just
This worked for me just fine...
http://www.trailheadinteractive.com
Thanks for trying this.I
Thanks for trying this.
I have tried your code on two D7 sites with properly enable php filter, on a server with php 5.3, one with pdo php handler, one with fcgid. Using a fake database name or table, I get a PDO exception on the latter site, which suggests the connection is being made. Using a real database name and table name, with the database set up in settings.php, both pages output the node title, but no 'hello' (or any results from the db query). Changing theme makes no difference. This is quite puzzling. Unless you were testing on Drupal 6?
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
It's 7.12 on PHP 5.2.9. I
It's 7.12 on PHP 5.2.9. I may try it again on 5.3 if I get time. Try wrapping your code in a try/catch block. Seems like something is failing in the eval. Does it work if you drop your PHP code into page.tpl.php, and cut out the eval()?
http://www.trailheadinteractive.com
I stuck it in page.tpl.php
I stuck it in page.tpl.php and it worked. Then tried again in a node and it worked for the first time.... I think am going crazy.... sorry to waste time, it was really not working before!
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors