Page 1 of 1

Unknow colum error in PHP after adding new column in MySQL

Posted: Tue Jul 18, 2006 8:23 pm
by croniccoder
I am running a query in my php code which works fine. I added a new column to my MySQL database and populated it with values.

In the SELECT statement in the php code, I added the new value to query the new column that was added, but for some reason I am getting a database error saying "Unknown column j.app_email", and I have no idea why. I have checked all spellings and everything I can think of, so this is why I am now posting.

Has anyone ever encountered an issue like this?

Code: Select all

SELECT j.app_phone, j.app_fax
FROM jobs j
Then added new column app_email to jobs

Code: Select all

SELECT j.app_phone, j.app_fax, j.app_email
FROM jobs j

Posted: Tue Jul 18, 2006 10:33 pm
by Burrito
how did you populate it?

try a

Code: Select all

desc jobs;
and see what it returns.

Posted: Wed Jul 19, 2006 7:16 am
by croniccoder
I populated it using UPDATE, similar to this:

Code: Select all

UPDATE jobs SET app_mail = 'me@there.com'
WHERE app_phone = '555-5555'

Posted: Wed Jul 19, 2006 9:06 am
by Burrito
but know how you that inserted the value really was if select from the table you can not?

Posted: Wed Jul 19, 2006 9:46 am
by croniccoder
Burrito,

Thank you for your responses. I figured out what the problem was (the test database I added the column to was actually writing to a different database because of the way that phpMyAdmin was configured).

When I fixed this so that the column I added was actually writing to the correct DB, all worked well.