|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Member
Join Date: Jul 2009
Posts: 2
|
Here goes
I'm building a php site that is suppose to connect to a mySql database in dreaweaver cs4. I use Xampp to install Apache, PHP, MySql, phpMyadmin they work great I've tested the server and its fine. I setup the site properly putting the folder in htdocs, the Url prefix is also as it should be. I've double checked these settings and visited a lot of tutorials. When i preview the index page it works on the localhost. The problem: is when i try and add a database to the page, i've created the database in phpMyadmin. In dreamwever CS4 wen i click the (+) sign in database and Click on Mysql Connection. I filled the form as follow Connection name: test MySql Server: localhost User name: (myusername) Password: (mypassword) Database: (database name) I get this error message when i test: Server timeout, reasons 1.Please make sure web server is up and running. 2.Please verify that the ODBC DNS exists on the testing server. Any help would be greatly appreciated.. ![]() ![]() ![]() ![]() ![]() |
|
|
|
|
|
#2 |
|
Community Advisor
![]() Join Date: Feb 2005
Location: from Madrid to Heaven
Posts: 3,049
|
Since you're connecting to a MySQL database, you don't have a DSN connection. You're timeout comes because something is not properly written.
Make sure that your spelling is exact to the names you used (for database, username, passwords... MySQL does know the difference between a capital letter and a lower case one )Make sure that MySQL service is active and working. Also, if you want to know what's happening remove the "die" bit (I think you don't have it but...) Example: Dreamweaver would have written something like this: PHP Code:
The "die" bits stop PHP from giving you a default error message and that's great when the site is shown to the public (they will not see the errors with messages they can't understand) but it is not so good for you, because you don't know what happens. |
|
|
|
|
|
#3 |
|
SitePoint Enthusiast
![]() Join Date: Nov 2008
Location: Slovenia, EU
Posts: 51
|
I had several times very similar problems with Dreamweaver and connecting to the database. The only solution I found working was reinstall. And that's why I started to use aptana studio. At first it's hard to work without the WYSIWYG editor but when you get used to it's much better and easier.
|
|
|
|
|
|
#4 |
|
Formerly 'arkinstall'
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2006
Location: Powys, Mid Wales
Posts: 6,173
|
@Molona: Not quite. The die() bit is required because otherwise the program will continue and throw a gazillion errors at the programmer, which may or may not be because of one single error.
However, by using die() (or exit - they do the same thing) in conjunction with the MySQL_Error() function, you can see what went wrong and stop the program: PHP Code:
Off Topic: Is this when trying to run the page, or when testing the connection? I was under the impression that this was a dreamweaver testing part before it even hits PHP, hence my request for it to be moved |
|
|
|
|
|
#5 | |
|
Formerly 'arkinstall'
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2006
Location: Powys, Mid Wales
Posts: 6,173
|
Quote:
You will find your code quality improves 10^100 times by handcoding. |
|
|
|
|
|
|
#6 | |
|
SitePoint Enthusiast
![]() Join Date: Nov 2008
Location: Slovenia, EU
Posts: 51
|
Quote:
And you will see what you were totally wrong about it ... |
|
|
|
|
|
|
#7 | |
|
Community Advisor
![]() Join Date: Feb 2005
Location: from Madrid to Heaven
Posts: 3,049
|
Quote:
![]() I don't think that it will bring to might light to this particular case though. It seems that it doesn't connect to the database at all and that makes me think of misspelling, MySQL service not running or bad installation. |
|
|
|
|
|
|
#8 | |
|
Formerly 'arkinstall'
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2006
Location: Powys, Mid Wales
Posts: 6,173
|
Quote:
![]() You DO see the errors, because MySQL_Error gives you the errors. So, you use die('error: ' . MySQL_Error()); so that it outputs the database error and stops the script from running further, potentially causing problems. |
|
|
|
|
|
|
#9 |
|
Community Advisor
![]() Join Date: Feb 2005
Location: from Madrid to Heaven
Posts: 3,049
|
I think that we have different systems to debug. Connection errors (especially at this early stage) do not throw a list of thousand errors. He could do that, of course. It is just another way.
|
|
|
|
|
|
#10 | |
|
Formerly 'arkinstall'
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2006
Location: Powys, Mid Wales
Posts: 6,173
|
Quote:
If a database connection fails, chances are the site will be severely broken anyway. In which case, killing it before it causes damage is a good move. Usually you'd include error details before killing it (hence mysql_error()), and that could vary depending on the development stage you're in. |
|
|
|
|
|
|
#11 | |
|
derrrp
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2006
Location: earth
Posts: 887
|
Quote:
As far as the WYSIWYG features go...they're all left alone and completely worthless, IMO. |
|
|
|
|
|
|
#12 |
|
Community Advisor
![]() Join Date: Feb 2005
Location: from Madrid to Heaven
Posts: 3,049
|
Let's get back to topic, shall we? This is not about different ways of working, if die() should be there or not, or if DW is great or not as a development tool.
Let's wait and see if anyone else can provide better solutions or if gxdante manage to give us more information so we can narrow the problem ![]() |
|
|
|
|
|
#13 |
|
SitePoint Enthusiast
![]() Join Date: Nov 2008
Location: Slovenia, EU
Posts: 51
|
@molona: you're right, go back to the topic. But unfortunately Dw doesn't works fine with database connection and does not recognize it if you write it on your own. That's my point of view.
|
|
|
|
|
|
#14 |
|
SitePoint Member
Join Date: Jul 2009
Posts: 2
|
Thanks all who have contributed but my problem remains.
1. The server is running 2. I double checked the connection data , user name etc... all correct This is the automatic code written by dreamweaver for the connection.. <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_test = "localhost"; $database_test = "test"; $username_test = "root"; $password_test = "*****"; $test = mysql_pconnect($hostname_test, $username_test, $password_test) or trigger_error(mysql_error(),E_USER_ERROR); ?> |
|
|
|
|
|
#15 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Jan 2007
Posts: 392
|
Dreamweaver is good for css coding, but using the WYIWYG for php/mysql?? You are blowing my mind.
|
|
|
|
|
|
#16 |
|
derrrp
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2006
Location: earth
Posts: 887
|
Hi,
Have you set up the testing server settings for your site? Go to Site->Manage Sites and edit the one your working on. If it's on Basic, switch to Advanced. Then go to the Testing Server option on the left. I've attached an image. It's from DW8, but the interface should be similar. For the URL Prefix, leave it to localhost unless you have virtual hosts set up. Hope that helps, though I'm not 100% if that'll do it. ![]() |
|
|
|
![]() |
| Bookmarks |
| Tags |
| php |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 13:27.






)








Linear Mode
