PHP/Mysql query problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
shruti0324
Forum Newbie
Posts: 4
Joined: Thu Dec 06, 2007 11:44 pm

PHP/Mysql query problem

Post 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)
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP/Mysql query problem

Post 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.
shruti0324
Forum Newbie
Posts: 4
Joined: Thu Dec 06, 2007 11:44 pm

PHP/Mysql query

Post 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.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP/Mysql query

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

I bet someone read your source code and that broke it.

Please see http://en.wikipedia.org/wiki/Unusual_so ... roedinbugs
erupt
Forum Commoner
Posts: 58
Joined: Sat Feb 25, 2006 10:24 am

Post 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?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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!
Post Reply