| 
Welcome, Guest
  • Page:
  • 1
  • 2

TOPIC: Reposting here - Cannot connect to other MySQL dbs

Reposting here - Cannot connect to other MySQL dbs 2 years 2 months ago #157618

  • djc
  • djc
  • OFFLINE
  • Junior Boarder
    Junior Boarder
  • Posts: 29
  • Karma: -
Since I upgraded to CB 1.4 I cannot execute a mysql_select_db() statement to select any database other than the database for the Joomla site.

This call does not return an error, it does not return at all and I am left with a blank screen

Code as simple as shown below will fail for any existing database unless 'xyz' is the Joomla database

<?
$con = mysql_connect("localhost",$username,$password);
$select = mysql_select_db('xyz',$con);
mysql_close($con);
?>

It doesn't even error, just hangs with a white screen....take out the mysql_select_db call and the page is displayed (but doesn't work because can't retrieve any data for the db).

When I restored the site from a backup I took just before the upgrade, everything started working again under 1.2.3

Any thoughts?

Thanks,
Dom
Last Edit: 2 years 2 months ago by djc.
The administrator has disabled public write access.

Re: Reposting here - Cannot connect to other MySQL dbs 2 years 2 months ago #157690

  • krileon
  • krileon
  • ONLINE
  • Moderator
    Moderator
  • Posts: 31416
  • Karma: 897
1.2.3 to 1.4 is a big jump, but CB has nothing to do with your query. You're using direct PHP methods and zero API, not even Joomlas. Please review existing plugins on how to use CBs database API or at very least review existing Joomla extensions/files on how to use Joomla API to perform a query. You can review an example of how to make external database queries with CB API within professional subscriber incubator project CB Queries (plugin.cbqueries.php).
Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Tutorials + Search the forums
CB links: Documentation - Tutorials - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Advanced, Professional, Developer, or CBSubs subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Advanced, Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
--
If you use Community Builder, please post a rating and a review at the Joomla! Extensions Directory.
The administrator has disabled public write access.

Re: Reposting here - Cannot connect to other MySQL dbs 2 years 2 months ago #157715

  • djc
  • djc
  • OFFLINE
  • Junior Boarder
    Junior Boarder
  • Posts: 29
  • Karma: -
Thanks for the reply...but I was not clear....I am not talking about using the CB database. This is a MySQL database that is unrelated to Joomla or CB. It is one that I maintain to keep track of other data necessary for the whole site to work properly.

I do use the CB API when I need to work with the CB data, but this is outside CB.

The interesting thing is that the mysql_select_db never returns so I cannot even process an error code.

In principal I agree with you that this should have no effect as I am using direct PHP methods, but as far as I can tell, the only change to the site is the change of CB version.

Regards,
Dom
The administrator has disabled public write access.

Re: Reposting here - Cannot connect to other MySQL dbs 2 years 2 months ago #157725

  • krileon
  • krileon
  • ONLINE
  • Moderator
    Moderator
  • Posts: 31416
  • Karma: 897
Is your query being executed from within CB or Joomla or from a 3rd party source? CB or Joomla have nothing to do with 3rd party queries. There's likely an error in your query. Sense you did not provide the full query I can't comment on if it's structured correctly or not. If executed from within CB or Joomla you should be using API (you can call external database with API).
Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Tutorials + Search the forums
CB links: Documentation - Tutorials - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Advanced, Professional, Developer, or CBSubs subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Advanced, Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
--
If you use Community Builder, please post a rating and a review at the Joomla! Extensions Directory.
Last Edit: 2 years 2 months ago by krileon.
The administrator has disabled public write access.

Re: Reposting here - Cannot connect to other MySQL dbs 2 years 2 months ago #157741

  • djc
  • djc
  • OFFLINE
  • Junior Boarder
    Junior Boarder
  • Posts: 29
  • Karma: -
Again, thanks for your reply....the query is being executed from within an article in order to get the proper information to display on the page.

I guess I wasn't clear....this site has been up an running for many months....the select_db call stopped working when I upgraded. No coding changes were made.

I will think about where else it could be happening and report back.

I appreciate your input!
Dom
The administrator has disabled public write access.

Re: Reposting here - Cannot connect to other MySQL dbs 2 years 2 months ago #157968

  • djc
  • djc
  • OFFLINE
  • Junior Boarder
    Junior Boarder
  • Posts: 29
  • Karma: -
OK...I just did it again to be sure that nothing else could have changed....I took the completely working site running with CB 1.2.3 and installed 1.4.

Again, as soon as the install competed, my article with embedded PHP code including a mysql_select_db() call would no display.

I have tested that simply commenting out that line and the page displays (but without all the data it needs). Additionally, I made a page consisting of simply the code from my original post (with the proper information in the arguments) and the page will not display. Comment out the select_db call and all works.

The call to the function never returns so no error code is generated.

While I agree that it does not make sense for it to be CB related, at the same time it is the only that does make sense as it is the only change.

Thanks for all the support!
Dom
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.215 seconds