problems with querying data from MySQL

problems with querying data from MySQL

Posted by: tardoid7
Posted on: 2005-06-23 16:19:00

Hi There,

My client is hosted here and I recently transfered their database from my test server to their dreamhost server through phpMyAdmin (both ways). All the data is shown on the dreamhost server, but when I go to the site nothing shows up. No MySQL error messages and no queries for their products. The only thing that I changed was the MySQL connection file to connect to the dreamhost database.

Here's what it should look like (my test server):
http://www.ff-p.com/technosonic/products.php

And this is what I get (dreamhost):
http://www.technosonic.com/products.php

Any help will be great.
Thanks,
Allan

Re: problems with querying data from MySQL

Posted by: Atropos7
Posted on: 2005-06-23 19:14:00

In reply to:

No MySQL error messages and no queries for their products. The only thing that I changed was the MySQL connection file to connect to the dreamhost database.


Is there nothing in the PHP code for the site to diagnose the problem? Does it or does it not have a way to indicate the connection failed, or the database doesn't exist, or there was an authentication problem? Or that a query for something that should return at least one row came up with zero rows? Does the PHP code have any calls to mysql_error() in it?

It's kinda hard to say what could be wrong other than it appears the PHP code appears to have a design flaw in its handling error conditions in its database operations....



cool Perl / MySQL / HTML+CSS

Re: problems with querying data from MySQL

Posted by: tardoid7
Posted on: 2005-06-23 20:14:00

I do have the "or die ('I cannot connect to the database because: ' . mysql_error());" in my database connection file.

But I did notice something different with the version of phpMyAdmin that's on Dreamhost compared to the version I have on my server - there's an attribute for the tables called "Collation" with the value of "latin1_swedish_ci ". This wasn't shown on my phpMyAdmin and I have no idead if that could be the problem. Should it be set as a different value?

Thanks for your reply,
Allan

Re: problems with querying data from MySQL

Posted by: decswxaqz
Posted on: 2005-06-24 00:10:00

Put various echo statements through the file. Like before and after the connection string, in loops through the products table. I think it's probably the connection string is wrong. Have you changed it from localhost to db_host.domain.com??

Re: problems with querying data from MySQL

Posted by: Atropos7
Posted on: 2005-06-24 01:36:00

In reply to:

I do have the "or die ('I cannot connect to the database because: ' . mysql_error());" in my database connection file.


What about queries? You could be getting errors such as bad table names or bad sql format or the like. You need something like

$result = mysql_query("SELECT * FROM tables_priv");
if (!$result) {
echo mysql_error();
exit;
}


cool Perl / MySQL / HTML+CSS

Re: problems with querying data from MySQL

Posted by: scjessey
Posted on: 2005-06-24 04:19:00

In reply to:

But I did notice something different with the version of phpMyAdmin that's on Dreamhost compared to the version I have on my server - there's an attribute for the tables called "Collation" with the value of "latin1_swedish_ci ".


When phpMyAdmin was recently updated, I got the same thing; however, it doesn't seem to have any effect on my database functionality. God only knows why that is the default value.

Re: problems with querying data from MySQL

Posted by: marsbar
Posted on: 2005-06-24 05:20:00

I also got the same thing (i.e. "latin1_swedish_ci" set for 'collation'). Furthermore, when I log into phpMyAdmin, on the first screen, I see on the right hand side:

"MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf-8_general_ci"

and across the bottom of the screen:

"The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results."

I believe the message in red only appeared after the recent phpMyAdmin update. Does anyone else get the same message? Is there anything I can do to address the problem, or is this a case for Support? Any help/advice will be greatly appreciated.

- marsbar

Re: problems with querying data from MySQL

Posted by: tardoid7
Posted on: 2005-06-24 07:10:00

God, I'm sooooooo stupid :)

There was a small typo in the name of the database....

Thanks to everyone who tried to help.

I'll start banging my head on the wall now :)

Tags: dreamhostmysql connectionmysql errortest servererror messagesphpphpmyadminhttptransferedquerieshelp