| | |
unable to connect PHP with Mysql
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2006
Posts: 116
Reputation:
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: 116
Reputation:
Solved Threads: 0
•
•
•
•
Why are you using ODBC connction r u using windows machine or linux server ? Arey you use MYSQL database or other?
but now i have to use mysql_connect and so on........ queries .
I have Windows Server 2003 Service Pack 1 version of windows.
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...)
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 9:31 pm.
If i am helpful, please give me reputation points.
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 my post is useful please add to my reputation.
Thanks.
Ajtrichards Web Solutions | http://www.ajtrichards.co.uk
Retenovate | http://www.retenovate.com
Thanks.
Ajtrichards Web Solutions | http://www.ajtrichards.co.uk
Retenovate | http://www.retenovate.com
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 4:54 am.
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: need help in php
- Next Thread: prev link
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess action address ajax apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date destroy directory display domain download dynamic echo email error errorlog file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link load login loop mail masterthesis menu mlm mod_rewrite multiple mysql oop paypal pdf php popup problem query radio random record recursion regex remote script search security server sessions sms soap source space sql syntax system table tutorial update upload url validation validator variable video web xml youtube






