Forum Moderators: coopster

Message Too Old, No Replies

Unknown column error

         

mooger35

5:43 am on Nov 17, 2006 (gmt 0)

10+ Year Member



"Unknown column 'schedule.homeid' in 'on clause'"

I'm not sure why I'm getting this error but I get it while testing but not when live. I'm testing on my computer using apache but when I upload it to my site's server I get no error and it displays as it should. Here's the offending code.

$query_schedule = "SELECT gameid, homeid, visitorid, home.teamname AS homename, visitor.teamname AS visitorname
FROM schedule, teams
INNER JOIN teams AS home ON (schedule.homeid = home.teamid)
INNER JOIN teams AS visitor ON (schedule.visitorid = visitor.teamid)
WHERE season = 2006
GROUP BY gameid
ORDER BY date2 ASC, gameid ASC";
$schedule = mysql_query($query_schedule, $connect) or die(mysql_error());

while ($row = mysql_fetch_assoc($schedule)){
echo $row['homename']." vs ".$row['visitorname']."<br>";
}

Any ideas why it would work on one and not the other?

I'm using mysql-5.0.26 and my server uses mysql-4.1.21. Both are using php ver 5.1.6.

Psychopsia

6:13 am on Nov 17, 2006 (gmt 0)

10+ Year Member



Hi!
Are you sure that the two databases has the same structure?

Try adding an alias to tables, like "FROM schedule AS s, teams AS t ..."

mooger35

6:39 am on Nov 17, 2006 (gmt 0)

10+ Year Member



Yes, the database structures are the same.

coopster

4:43 pm on Nov 20, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could DESCRIBE [dev.mysql.com] the table to be sure you are looking at the table as you designed it.