Problems with querying data from MySQL


#1

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


#2

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


#3

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


#4

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??


#5

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


#6

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.


Simon Jessey
Keystone Websites | si-blog


#7

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

EDIT:
Oops! I should have done a search before posting. Someone else has posted the same problem in this thread, “mbstring php extension missing”. With apologies,

  • marsbar

#8

God, I’m sooooooo stupid :slight_smile:

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 :slight_smile: