Jump to content


Photo

Query can't find MYSQL table.


  • Please log in to reply
4 replies to this topic

#1 mdraft

mdraft
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 July 2006 - 06:31 PM

Hello,

I'm a newbie to PHP and I'm struggling with making a change to my code. I would like to pull data from a different table in the same database. However, when I change the table reference to the other table (both the old and new tables are valid, existing tables), I get the following error:

Unknown table 'CY Players' in field list

The following is the beginning of the code. I have highlighted the line that I would like to change from "PY Players" to "CY Players". Any ideas? Thanks!

<?php

//MODULE exec query (mysql 4.1 is required)

// calc limits
$in['limitQB'] = $in['teams']*$in['qbs'];
$in['limitRB'] = $in['teams']*$in['rbs'];
$in['limitWR'] = $in['teams']*$in['wrs'];
$in['limitTE'] = $in['teams']*$in['tes'];

//  long select
$sql="
SELECT

`CY All Players Combined Values`.Name,
`CY All Players Combined Values`.Team,
`CY Bye Week`.Bye,
`PY Players`.Consistency,
`PY Players`.HC,
`PY Players`.Fade,
`CY All Players Combined Values`.Pos,
`CY All Players Combined Values`.Expr1 AS `Avg Starter`,
`CY All Players Combined Values`.Expr2 AS `Min Starter`,
`CY All Players Combined Values`.Expr3 AS `StdDev Starter`,
`CY Fantasy Pts Sorted`.`Total FP` AS `This Yr Proj`,
`CY Fantasy Pts Sorted`.`Total FP`/`PY Fantasy Pts`.`Total FP`*100 AS `% of Last Yr`




#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 July 2006 - 06:42 PM

I won't even ask why your table names have spaces in them... but apparently, such a table doesn't exist, as far as MySQL is concerned.  Post the SHOW TABLES output.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 mdraft

mdraft
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 July 2006 - 09:14 PM

The following is the result given for SHOW TABLES.

Thanks for any help you can give me.

SQL query 
SQL query:
SHOW TABLES 
[ Edit ] [ Create PHP Code ] [ Refresh ]




 
Tables_in_m0n_projections 
CY All Statistics
CY Bye Week
CY Players
PY All Statistics
PY Bye Week
PY Players
item_table
paypal_table



#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 July 2006 - 10:11 PM

Well, the table is there... post your complete query; my guess is you haven't included that table.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 mdraft

mdraft
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 13 July 2006 - 12:01 AM

Thanks for your help. I found that I had missed a "join" command that needed to be changed.
Thanks again!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users