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
eektech909
Forum Commoner
Posts: 34
Joined: Fri Jun 09, 2006 3:59 pm

query problem

Post by eektech909 »

I built the php page on my personal server and it runs fine.

I then added it to the website server that has php and mysql installed.

database name: sbaker
table name: shows

when i run

Code: Select all

$display = mysql_query("SELECT * FROM SHOWS WHERE DATE >=  '$todays_date' ORDER BY Date");

if (!$display) {
echo mysql_error();
exit();
}
it seems to add the database name to the table name so the mysql_error is

TABLE 'sbaker.SHOWS' doesn't exist.

help?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what does "SHOW TABLES" return?
eektech909
Forum Commoner
Posts: 34
Joined: Fri Jun 09, 2006 3:59 pm

Post by eektech909 »

it returns

Resource id #2
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Running a standard fetch loop over it should yield data. That's what I'm after.
eektech909
Forum Commoner
Posts: 34
Joined: Fri Jun 09, 2006 3:59 pm

Post by eektech909 »

it needs to get the info from the table "shows" but is trying to get it from "sbaker.shows" instead, and its not programmed to try to get info from sbaker.shows.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

sbaker is the name of your database, shows is the name of your table. therefore sbaker.shows would be your table. So, that is correct.

I noticed you used all caps in your query. Are you sure the table isn't named "shows" instead of "SHOWS". Caps do matter.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply