Connecting To Multiple Databases With Sqlsrv_connect?

May 7, 2011

Basically at the moment I can connect to one database at a time. The thing is the data that I am querying is from multiple website (all starting with V1_database.....). For example my database include V1_database_newyork or V1_database_denver etc.

I have created a query like this in Microsoft SQL Server Management Studio which picks up all the database beginning with V1_database:

SELECT name
FROM sys.databases
WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb') AND name LIKE 'V1_database%'

My current code to connect to one of my databases is as follows (this works fine):

<?php
/*data base connection */
$serverName = ".SQLEXPRESS";
$connectionOptions = array("Database"=>"V1_database_newyork",
"UID"=>"username",

[Code]....

ADVERTISEMENT

Sqlsrv_connect() Not Found?

May 20, 2010

I recently am working on an projekt that uses the "SQL Server Driver for PHP", i wanted to upgrade the existing driver to the new version (2.0), because I need some of the functions that have been implemented there.

Now i replaced the old .dll in the php/ext directory and restarted the webserver. But now i recieve the following error:

Fatal error: Call to undefined function sqlsrv_connect() in E:ProjekteExternhades_aplclassessqlsqlsrv.class.php on line 34

But if i run phpinfo();, sqlsrv shows up, in the same way as the previous version did.

View 1 Replies View Related

Using Sqlsrv_connect On Platforms Other Than Windows?

Jul 22, 2009

I've inherited some code that uses the sqlsrv_connect method to instantiate a connection to a SQL Server database. My personal development machine is an OS X box that I'm running apache an PHP on. I have an instance of SQL Server running in a virtual machine. When I attempt to connect to the database, I get the following error. Fatal error: Call to undefined function sqlsrv_connect() in ...It appears that sqlsrv_connect is not part of standard PHP, and is part of a driver that ships with SQL Server 2005. (please correct me if I'm wrong here Is there a way to use this function on Non-Windows platforms? I realize I could install/build an Apache/PHP instance on my Windows machine, but if there's a way to get this function working on OS X (or other *nixes) I'd prefer it.

View 3 Replies View Related

Connecting To Multiple Databases?

Jul 1, 2011

I am using sphinx for a site search and it works great but now I am trying to connect to 2 mysql databases with the same exact structure and db2 is a continuance of db1 so all info should flow smoothly. I can easily get the results by switching the db name in the code but how can I select both at once?

here is some code im using

$CONF['sphinx_host'] = 'localhost';
$CONF['sphinx_port'] = 9312;
$CONF['mysql_host'] = "localhost";
$CONF['mysql_username'] = "user";

[Code].....

This code works fine if i enter a single mysql db into $CONF['mysql_database'] = "db1"; but I need to select from db1 and db2. Does anyone know how I can achieve this? Also I did not post the query because I don't think it is very useful it is just a simple select query and I am sure you get the idea.

View 1 Replies View Related

Escaping Strings Passed To A Sqlsrv_connect Function?

Jan 27, 2011

I have been using the sqlsrv driver for php and have an array of connection details which I then pass to the sqlsrv_connect().This has worked fine for standard passwords, however, it has run into trouble when I tried a password string which containted a $ symbol and got the following notice:

Notice: Undefined variable: xxxx in xxxxclassesClass.Database.php

The undefined variable is all the characters after the $ symbol.

View 1 Replies View Related

Wordpress - Connecting To Multiple Databases?

Mar 24, 2010

I have various websites. 2 or 3 utilize wordpress as a CMS, and use the ExecPHP plugin to execute my PHP content. The others do not use any CMS. I want to setup a system such that a user can register on any ONE site, and that registration is valid for every site in my network.

My idea was a separate database for user information. I could then switch between each sites database and the 'users' database. This is extremely complicated with wordpress however, as I cannot go through and change every wordpress query to include the database which it is querying.

View 5 Replies View Related

Zend Framework : Connecting To Multiple Databases One At A Time?

Jan 7, 2011

The problem I am having now is that when I get to the next database, its still selecting from the first database and not the new one.Is it possible to close a connection and then open a new connection while running a script. Remember this is just a script I have no bootstrap set. I just setup a autoload to that I can load my models.While looping through sections of the ini

try {
$db = Zend_Db::factory($section->database->type, $section->database->toArray());
Zend_Db_Table::setDefaultAdapter($db);

[code]...

View 1 Replies View Related

CLI Service Of Routing, Connecting, Dis-connecting, Hanging Up And Other Stuff With VoIP Calls?

Sep 27, 2006

i have a PHP-CLI service that takes care of routing, connecting, dis-connecting, hanging up and other cool stuff with VoIP calls. However since is a *service*, is always running. Im just starting the beta tests and I have found the memory is incrementing in an ugly rate of 1Mb for each 4 calls ... I think this is an error that I can find without problems. But, I think there must be better ways of doing memory monitoring or debugging.

View 2 Replies View Related

Connecting To Mysql But Not Connecting

Apr 4, 2007

I'm including a database connection file from another website. eg. include(http://domain1.com/dbc.inc.php) is in my page on domain2.com - now I tihnk both these domains are on the same server but I tihnk thats probably irrelevant.

The issue is that the file includes and runs perfectly, it says it has successfully established a mysql connection, however when I try to use that connection it says there is no connection... or more correction it says Warning: mysql_query(): Access denied for user 'nobody'@'localhost' (using password: NO) in ...

Warning: mysql_query(): A link to the server could not be established in...

which usually means, you forgot to include your db script dummy. now I could just create 'dummy' pages that just have include(domain1.com/pagename.php) and that would work because we do a similar thing on other pages to grab the content.

View 5 Replies View Related

Php & Connecting

Jun 5, 2001

For example I have an IP : port and on connect (for example using telnet) it shows me some info (like current air temp) and after it closing connection.

How can i insert it on my web page using PHP? And on every visit on this page php connects to this IP, gather this info and shows it on page?

View 3 Replies View Related

Connecting To Db..

Jun 6, 2006

this seems pretty straight-forward.. got this code

$link = mysql_connect('localhost:3306', '<uid>', '<pswd>');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully'
mysql_close($link);

from here..
http://us2.php.net/function.mysql-connect

but can't connect, get this error:

Connect to db:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
MySQL server on 'localhost' (10061) in
C:xamppxampphtdocshomeconn.php on line 19
Could not connect: Can't connect to MySQL server on 'localhost' (10061)

I connect to this same MySQL server from Tomcat w/no problem.. what is
issue here pls...

now on top of pg mentioned above, there this description:

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link [, int client_flags]]]]] )

what does 'resource' refer to here pls... and where to do specify what
db to connect to... (in java you put db-name in same line where you
make the connection..)
(and don't you need a driver to connect, I use a JDBC driver to
connect w/Java..)

View 7 Replies View Related

Connecting To FTP

Nov 12, 2006

I'm trying to connect with FTP to run a CHMOD command or whatever you want to call it with PHP.

PLEASE READ THIS:
http://codingforums.com/showthread.php?p=504574&posted=1#post504574

There it will explain exactly what I'm trying to do... But for now, I'll give you the 411. I've erased all coding and I'm starting from scratch just for testing. So, basically, all that coding you saw on the previous page is worthless for now.

PHP.net MANUAL - CHMOD:
http://us3.php.net/manual/en/function.chmod.php

If you scroll down on that page, you'll see how they connected with FTP. I don't understand much of any of it...

So, basically, what does every each and every part of that coding mean? How does it work when it's all put together?

View 7 Replies View Related

Connecting To DB

May 1, 2004

I was using MySQL, but now our hosting company doesn't support MySQL so I am having to use it instead. I can't seem to connect to the DB. I have used the mssql_connect instead of mysql_connect but I get this error: PHP Fatal error: Call to undefined function: mssql_connect() in db_config.php on line 2. The hosting company seems to be a pain in the butt to deal with for tech support so if this is an error on my side I would rather resolve it without having to contact them.

View 1 Replies View Related

Connecting To An API

Jun 21, 2007

I need to use a company's API in order to try and convert video files into flash files and then play them Youtube style. There is a set API to use, but the instructions are incredibly vague, and me being new to APIs in general, I have absolutely no idea where to start to get the results. I can program basic PHP forms and database stuff, but this is all new to me. Code:

View 1 Replies View Related

Connecting To A Different Host

Sep 17, 2002

Is there anyway to connect to a given host from a form and do all the processing of information and calculations at that host and then display the results on the clients computer? I was thinking of a socket connection but I don't know if that would work well. Any suggestions would be appreciated.

View 2 Replies View Related

Connecting To A Acess DB

Apr 21, 2004

I have been connecting to an acess db by ODBC. i am wondering if there is another way to connect to it.

View 1 Replies View Related

Memcache Not Connecting

May 29, 2007

memcache appears to be installed correctly, but when I use
memcache_connect I get the following error:
Warning: memcache_connect(): Can't connect to localhost:11211, Unknown
error (0)

I'm connecting using the following command:
$memcache_obj = memcache_connect('localhost', 11211);

Memcache info from phpinfo():
memcache
memcache support enabled
Active persistent connections 0
Revision $Revision: 1.53 $

Directive Local Value Master Value
memcache.allow_failover 1 1
memcache.chunk_size 8192 8192
memcache.default_port 11211 11211

Finally, var_dump(extension_loaded('memcache')); returns true.

View 2 Replies View Related

Connecting To Access Db

Jun 24, 2003

i was working with asp but the site is launched in linux server.had to switch to php.
i had a access db admin.mdb i need to connect to admin.mdb and insert and retrieve data from it.

View 1 Replies View Related

Connecting To Pervasive SQL

Mar 17, 2003

In a development I'm doing I need to connect to a Pervasive SQL database to retrieve some data for use in my application.

In the PHP documentation I couldnt' find any connections to Pervasive SQL and would prefer not to use ODBC as the app will be running of a Linux box, while the Pervasive SQL is running on a Windows Box. Do you have any suggestions how I can create a connection to Pervasive SQL with PHP?

View 2 Replies View Related

PHP Not Connecting To MySQL?

Dec 19, 2005

I installed Apache 2.0.55, PHP 5.1.1, and MySQL 5.0.17 (in that
order, on Windows XP). I have managed to get Apache and PHP working
right, and MySQL by itself seems ok too. However, when I try to do any
MySQL command within PHP, it just does nothing. No success, no error.
I tried uncommenting the line "extension=php_mysql.dll", but when I
restart Apache it tells me "PHP Startup: Unable to load dynamic library
php_mysql.dll - The specified module could not be found.". No matter
where I copy the file so that it can find it. No matter what I put in
"extension_dir".
What's wrong?

View 1 Replies View Related

Connecting To Mysql With Php

Feb 14, 2006

I have been racking my brain trying to figure out what I am missing trying
to follow this book to get a php script to work. I would really appreciate
if someone could point out my errors. I've been up really late going over
all the config files. Why do they always scim installation for the
applications and put it in the Appendix when its the first thing that new
users need to do. Then we run into these problems because the author takes
so much for granted

I'm using Apache 2.0.55 with PHP 5.1.2 and MySql AB 5.0.18. Windows XP SP2.

What I believe I'm missing is how do I tell PHP & Apache where the Databases
are??

Here is the pathing my my installs.
C:/mysql/bin, c:/mysql/data/books, c:/apached/apache2/htdocs for servering
up web pages, and c:/php.

Here is the error log in apache, and the script ....

View 11 Replies View Related

Connecting To Aim And Sending IMs

Mar 25, 2002

Is it possible to write an Instant Messenging client that connects to the AIM servers in PHP? I want to write a small script that would sign on a screen name, and send an instant message to someone after they've put their screen name into a form. Does anyone have any idea how difficult or complicated this would be?

View 6 Replies View Related

Connecting To SQL Server Using PHP

Jul 17, 2005

I am still trying to connect to SQL Server 2000 (MSDE) form PHP

I did the following:
1. enabled php_mssql.dll extension in php.ini (phpinfo() shows it)
2. every dll is in proper place (System32 or php folder and few more
folders just to be sure) including
ntwdblib.dll

I am running Apache, PHP 4.3.9 and MSDE on the same machine with Win2k

SQL server config.:
1. Two instances: default SERVER and SERVERPortal
2. Both instances are using SQL auth mode, and user that I try to log
in has db admin rights

can't connect to any of the instances :(

I tried the following:
1. specyfing the port in mssql_connect ('SERVERPortal,1433') DIDN'T
WORK
2. different notations 'SERVERPortal' or 'SERVERPortal' DIDN'T WORK
3. different naming like: SERVER, localhost, 127.0.0.1 DIDN'T WORK

The ASP pages that are using the same sql server work fine :| so there
is a connection to the server for
ASP :]

So my question is what I did wrong?

and another question is: How to connect to a named instance of a sql
server if it isn't running on the
same machine with web server, what would be the connection string in
mssql_connect?

View 7 Replies View Related

Connecting To SQL Database

May 10, 2006

I have been asked to create an e-commerce website, where we need to
connect to an SQL database. The database is used to run their POS in
several branches. As this database is on the company server and we are
hosting the website with a webhost we have to solve an communication
issue.

Here are the options that I can see:

a. create a branch like environment on the webserver and then directly
access the branch database (OBDC??)

b. run a script that sucks data from the SQL environment and then ftps
it as a text file to a LAMP server. PHP and Mysql (my preferred
platform), will then notice the new file and do something with it?

c. have a direct OBDC connection between the website and the company's
server

What option do you recommend? What difficulties do you see?

I would love to get some ideas from you and more ideas on the typical
problems.

View 3 Replies View Related

Connecting To IP Address

May 22, 2007

I've recently set up a new MySQL server on a machine here at work and don't yet have a domain name assigned so I'm just using the ip address. For my connect statement, would the syntax be: PHP Code:

$con = mysql_connect("xx.xx.xx.xx:3308", "user", "pass");


I've tried that and it doesn't seem to be working. Port 3308 is the port I assigned to the server during setup. I can connect to the server remotely using that information in MySQL Command Center but it doesn't seem to be working for my form.

Also, once I do get a domain name set up, will php automatically direct any mysql queries to the mysql server at that domain or do I need to set up port forwarding or something? Edit: Oh, forgot to add, all of my code works fine when ran on phpnet.us but not when ran on my local server, which is what leads me to believe its a problem with the connection statement.

View 7 Replies View Related

Connecting To A MySQL DB

Jan 3, 2006

When I try to connect to my database (myhomepageUsers) i get this error:

Warning: mysql_connect() [function.mysql-connect (http://www.php.net/function.mysql-connect)]: Unknown MySQL server host 'myhomepageUsers' (11001) in c:program filese-novativeWAMPwwwmySQLindex.php on line 5

with this code:mysql_connect("myhomepageUsers");

I don't understand why this happens because the database exists.

View 8 Replies View Related

Connecting To MSSQL

Jul 17, 2005

I am experiencing problems connecting to MSSQL.
I'm not sure where to begin looking for the problem.
I don't know if the problem is originating with PHP or MSSQL

What should the host name be? When I mouse over MSSQL manager it says
"S-CIS-0042"

$db_host='local' //IP/host of the database server
$db_login='sa' //database login name
$db_password='******' //database password
$db_name='Cheetah' //database name on the server

View 2 Replies View Related

LDAP Not Connecting Through SSL

Mar 24, 2006

I am running into a problem where when I attempt to connect to a remote LDAP server using LDAPS on port 636 my request is not being sent via SSL.

This is causing my connection to lockup when I attempt a to bind, search or anything other than connect. Does anyone have an idea of how to fix this.

running
PHP 4.4.0
IIS 5.1

View 2 Replies View Related

Not Connecting To Database

Jul 17, 2005

My website suddenly stopped working and I got the error. Fatal error:

Call to undefined function mysql_connect() in
C:inetpubwebrootlinks.php on line 7

I was using php 4.3 and the site worked fine. What has happened here?

View 2 Replies View Related

Connecting To My Database

Jun 12, 2007

my script is not connecting to my database, i get this error

Warning: mysql() [function.mysql]: Access denied for user 'apache'@'localhost' (using password: NO)

when i installed the script it did build the info in the database, but its not connecting to it when you run the script. please keep in mined that the script is encoded, so i cant change the code, this script works perfect on other peoples websites, im just the only one having a problem, but why is it going to use 'apache'@'localhost'. t should use root. how to fix it ?

View 16 Replies View Related

Connecting To An FTP Server

Dec 11, 2006

I'm creating an "easy ftp" web interface, but its turning out to not be so easy coding-wise ;) So the idea is this i will have a form on a webpage hosted on SERVER1 that prompts the user to upload a file. A form handling php script residing on SERVER1, parses the form, and uploads the file to SERVER2 (a remote ftp server), then mails somebody the location of the uploaded file. I can do everthing in this process with relative ease, but the step transfering the file from SERVER1 to SERVER2. Here is my file-handling code.

<?
$host = "ftp.someonesftpserver.com";
$hostip = gethostbyname($host);
$conn_id = ftp_connect($hostip);
if(!$conn_id)
{
echo "no dice";
die;
}

// login with username and password
$ftp_user_name = "*****";
$ftp_user_pass = "*****";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// IMPORTANT!!! turn passive mode on
ftp_pasv ( $conn_id, true );
if ((!$conn_id) || (!$login_result))
{
echo "FTP connection has failed!";
echo "Attempted to connect to $host for user $ftp_user_name";
die;
}
else
{
echo "Connected to $host, for user $ftp_user_name<br>";
echo "Host IP is $hostip<br>";
// upload a file
$remote_file = $path.$filename;
$file = $_FILES['uploadfile']['tmp_name'];
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII))
{
mail($to,$subject,$message,$headers);
echo "successfully uploaded $file<br>";
}
else
{
echo "There was a problem while uploading $file<br>";
}
// close the connection
ftp_close($conn_id);
}
?>

The code looks straight forward enough, but all im getting is "no dice" which means either the connection is timing out (90sec, not likely) or im just not going about this right.
I've talked to the server's owner, and he says that i should try connecting through a certain proxy server. Should i really need to do that? And if so, does anyone have any idea how this is accomplished? I have searched the php.net manual, and the general web to no avail. Even a couple of statements that would help me debug connection part of the script would be a immense help, because right now its giving me no specific errors.

View 1 Replies View Related

Connecting Between PHP And MySQL

Feb 26, 2006

I've tried to run some textbook examples by moving them from the textbook CD to my HD, and running them through the local host. The trouble is that in this function

function dbconnect ($dbname="test",$user="nobody",$password="",$server="localhost")

I do not know where to store my sql database in in order for the PHP script to access the corresponding database. and the password and username... is the default in this manner?

View 1 Replies View Related

Connecting/Working With MSN

Jul 26, 2006

I'd like to be able to create a very simple online msn messenger client. The obvious problem with this is, I don't have a single clue where to start. I know nothing what-so-ever about the msn protocol. Nothing at all, not how to connect to it, just nothing. So what I'm essentially asking is, is there a nice and easy class for me to use somewhere? Functions to connect and use MSN anywhere? Anyone done this before? If not, is there an article somewhere which can at least get me started?

View 10 Replies View Related

MYSQL Connecting

Dec 7, 2005

Just actually wondering how mysql and php connect??? Is it via an odbc? How is the odbc setup?

View 2 Replies View Related

Database Not Connecting

Jul 21, 2005

on one of the scripts I have this code:

[code]
mysql_connect ("localhost", "database", "****") or die (mysql_error());
mysql_select_db ("dotan_stats");

$query = "TOP SECRECT QUERY!";
$result = mysql_query($query);

print "
<!-- ".mysql_error()." -->";
[code]

And I get this in my HTML code:
<!-- No Database Selected -->

Does anybody see anything obvious that would cause it not to connect? Where can I begin to debug?

View 1 Replies View Related

Connecting Arrays

Sep 13, 2005

Strings can be connected using .=

$rice .= "a";
$rice .= "b";

But how do you do it with arrays?

View 1 Replies View Related

Connecting In MySQL

May 31, 2005

I was wondering if there was any way to block specific IPs from connecting to MySQL? for example, I want all machines on my internal network to be allowed to connect except for one. I use 192.168.1.% in mysql.user table and it works fine. Is there a way to leave that and disallow just one host? Or must I remove that line and enter evry other IP on my network one by one.

View 2 Replies View Related

JSP Or For Connecting To Oracle

Feb 25, 2007

My client is very pro JSP; however, I would prefer to use PHP to connect to an Oracle DB, as I am more familiar with it. What advantages, if any, does JSP offer over PHP, specifically with regard to connecting to an Oracle DB?

View 2 Replies View Related

Connecting To Mysql

Aug 8, 2005

I am trying to connect to mysql and am using the following function unsuccessfully:

<?php
mysql_connect("localhost", "dave", "skater") or die(mysql_error());
echo "Connected to MySQL<br />";
?>

View 2 Replies View Related

Connecting Database With PDO

Jan 19, 2011

It's the first time i'm using PDO just for testing purpose. But a strange error occurred and googling it, it seems to be weird. Here's my database testing class

[Code..........]

View 4 Replies View Related

Connecting To MDB2?

Jun 8, 2011

$dsn="mysql://$db_username:$db_password@$db_hostname/$db_database";
global $mdb2;
$mdb2=MDB2::connect($dsn);
if (PEAR::isError($mdb2))
{
die($mdb2->getMessage());
}

I do this to connect to my DB, I put this in a separate php file called Connect.php and require it on all my pages. However, when I have to query inside a function, I will have to pass $mdb2 to the function as an argument? Is this the right way to do it. Further, I am writing a class which will query my DB. And I have no idea what to do (I don't wanna pass it as an argument) Do I have to re-establish the connect everytime (ie. write a function for connection) Can't you make the connection persistent and global?

View 1 Replies View Related

VB Connecting To A Website?

Mar 24, 2009

I have a VB application that connects to a PHP page for user validation, and I'm having some problems getting it to work for a particular user. I didn't wanna double post in both forums and Im not sure if its a PHP or VB problem so here is the main thread.

[URL]

View 2 Replies View Related

Connecting To A Second Database?

Apr 27, 2009

how to connect to a second database to grab information from a table. This second database has a different username and password that the one the website is currently using (it is on the same server however).I've hunted through the forums for a solution and aside from a large amount of "how to connect to two tables" type situations I haven't found anything that assists me with figuring this out.

I tried a completely separate connection string - i.e. :


PHP Code:


// Primary Database Connection //
$connect = @mysql_connect("localhost", "user", "password") or die(mysql_error());
$db = @mysql_select_db($database, $connect) or die(mysql_error());[code]....


... but that fails as further down another query into the primary database fails because it's looking into the secondary database instead.Additionally, I can accomplish this by closing the primary database connection, opening one to the secondary database, grabbing what I need, then closing the secondary and re-opening the primary - but that's a lot of db connections to open and close and not very efficient.

View 9 Replies View Related

Connecting To An FTP Site Using PHP

Sep 25, 2007

I am trying to create a script that will connect to an FTP site and grab a file from that site. It will then format that file and place it on the root on my machine. I keep getting "SITE EXEC" not understand on line 22. Below is my script. Any help will be greatly appricated. Also the IP address, username and passcode is purposely 'X' out. Code:

View 1 Replies View Related

Connecting / Registering

Aug 21, 2007

i try to register a new account to my game it says "cannot register user". ive searched for this in my php files but cannot find it. also, when i try to log in to my game, it works and displays the new page. but the moment i refresh it says i am not logged in again. is this a problem with my cookies? does anyone have any ideas?

View 14 Replies View Related

ADVERTISEMENT