•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,083 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,948 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1371 | Replies: 8
![]() |
•
•
Join Date: Sep 2006
Posts: 104
Reputation:
Rep Power: 2
Solved Threads: 0
I am new to PHP. I am trying to connect mysql with PHP with
mysql_connect but i m getting
"A link to the server could not be established"
I have used ODBC 3.51 driver for odbc and made connections with odbc with odbc_connect
but i don't know how to connect it with mysql_connect and fire mysql_-----queries.
Is there any specific driver for tht?
mysql_connect but i m getting
"A link to the server could not be established"
I have used ODBC 3.51 driver for odbc and made connections with odbc with odbc_connect
but i don't know how to connect it with mysql_connect and fire mysql_-----queries.
Is there any specific driver for tht?
•
•
Join Date: Sep 2006
Posts: 104
Reputation:
Rep Power: 2
Solved Threads: 0
•
•
•
•
Why are you using ODBC connction r u using windows machine or linux server ? Arey you use MYSQL database or other?
I told tht i have used ODBC 3.51 driver and used odbc_connect and so on......... queries ....
but now i have to use mysql_connect and so on........ queries .
I have Windows Server 2003 Service Pack 1 version of windows.
•
•
Join Date: Oct 2004
Location: On Earth, I think...
Posts: 246
Reputation:
Rep Power: 4
Solved Threads: 4
Are you sure the server is running? (check the obvious first :-)
Also check the order of the arguments to mysql_connect - it's server, user, password. (I somehow manage to forget that every single time I use mysql, and PHP yells at me for it a lot :-)
If the mysql and web servers are on different computers, make sure there isn't a firewall blocking them (sounds like something Windows Firewall would do...)
Also check the order of the arguments to mysql_connect - it's server, user, password. (I somehow manage to forget that every single time I use mysql, and PHP yells at me for it a lot :-)
If the mysql and web servers are on different computers, make sure there isn't a firewall blocking them (sounds like something Windows Firewall would do...)
•
•
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation:
Rep Power: 30
Solved Threads: 264
You do know you need to copy the mysql dlls from the mysql directory to the PHP one and point the PHP config file at them?
This is probably as in PHP5 they removed MySQL support (was in by deafult before)
This is probably as in PHP5 they removed MySQL support (was in by deafult before)
Last edited by jbennet : Apr 27th, 2007 at 8:31 pm.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
james.bennet1@ntlworld.com
•
•
Join Date: Nov 2006
Location: South Wales
Posts: 159
Reputation:
Rep Power: 2
Solved Threads: 10
Once you have completed all the above you should use the following code to connect -
mysql_connect('HOSTNAME', 'USERNAME', 'PASSWORD');
if(mysql_error()) {
echo mysql_errno().'<BR>
mysql_error();
}
mysql_connect('HOSTNAME', 'USERNAME', 'PASSWORD');
if(mysql_error()) {
echo mysql_errno().'<BR>
mysql_error();
}
If you find my post useful please add to my reputation!! Thanks!
ajtrichards web solutions
http://www.ajtrichards.co.uk
ajtrichards web solutions
http://www.ajtrichards.co.uk
•
•
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation:
Rep Power: 30
Solved Threads: 264
Might be worthwhile doing an advanced search for all forum posts where i have posted as I member a while ago i posted a zip file constaining a whole load of PHP/MySQL example code like that.
Last edited by jbennet : Apr 28th, 2007 at 7:59 am.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
james.bennet1@ntlworld.com
•
•
•
•
You do know you need to copy the mysql dlls from the mysql directory to the PHP one and point the PHP config file at them?
This is probably as in PHP5 they removed MySQL support (was in by deafult before)
you dont need to copy mysql dlls even in php 5 u just hav to add php folder and mysql folder to the windows path
Last edited by w_3rabi : Apr 29th, 2007 at 3:54 am.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: Exclamation points at odd places in php email.
- Next Thread: prev link



Linear Mode