| | |
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 |
advanced ajax apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert integration ip java javascript job joomla js limit link login loop mail menu mlm multiple mysql oop parse password paypal pdf php problem procedure query radio random recursion regex remote script search server sessions smarty smash sms soap source space sql stored syntax system table traffic tutorial unicode update upload url validator variable video web xml youtube






