Page 1 of 1

PHP/Mysql query problem

Posted: Fri Dec 07, 2007 12:06 am
by shruti0324
i have written a code in PHP which connects to the database,my code is correct but im not getting the output on the screen,im getting cannot connect to mysql.what may be the problem.Im using PCQ Linux 2005,Mysql version is 12.22 Distrib 4.0.23 for pc-linux(i686)

Re: PHP/Mysql query problem

Posted: Fri Dec 07, 2007 2:26 am
by califdon
shruti0324 wrote:i have written a code in PHP which connects to the database,my code is correct but im not getting the output on the screen,im getting cannot connect to mysql.what may be the problem.Im using PCQ Linux 2005,Mysql version is 12.22 Distrib 4.0.23 for pc-linux(i686)
Since it isn't working, what makes you think that your code is correct? Seriously, you haven't given us any way to know what the problem is. If it says that it cannot connect to mysql, that's exactly what the problem is. Either the mysql server isn't running on the host that you named in your connect statement, or it doesn't recognize the mysql user or password.

PHP/Mysql query

Posted: Mon Dec 10, 2007 8:14 am
by shruti0324
I know my code is correct as i have executed before the code in my college,but at home its not giving the output.

Posted: Mon Dec 10, 2007 9:31 am
by John Cartwright
Again, how on earth can we help with information you've provided? Are you handling errors? i.e. mysql_error()

Code please.

Re: PHP/Mysql query

Posted: Tue Dec 11, 2007 6:16 pm
by califdon
shruti0324 wrote:I know my code is correct as i have executed before the code in my college,but at home its not giving the output.
Well then, you will have a different server, user and password, you don't know if the server is running, you're in an entirely different environment. The fact that your code worked at school doesn't mean that it will work in a different computer network. You must start with determining if your mysql server is running. Do you have other scripts that connect with the database at home? Can you connect to mysql server from the command line? Do you even have mysql server running at home?

Posted: Tue Dec 11, 2007 7:19 pm
by Benjamin
I bet someone read your source code and that broke it.

Please see http://en.wikipedia.org/wiki/Unusual_so ... roedinbugs

Posted: Thu Dec 20, 2007 9:36 am
by erupt
astions wrote:I bet someone read your source code and that broke it.

Please see http://en.wikipedia.org/wiki/Unusual_so ... roedinbugs
Sort of an old thread but I just read this wikipedia entry .. and it sort of made me laugh, is that a joke? Do those really exist or are they myths?

Posted: Thu Dec 20, 2007 9:45 am
by Kieran Huggins
They're real enough, and that's what matters.

My code always works flawlessly until I test it. Damn you and your cat, Schroedinger!