Unknow colum error in PHP after adding new column in MySQL

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
croniccoder
Forum Commoner
Posts: 27
Joined: Fri Jul 07, 2006 10:45 am

Unknow colum error in PHP after adding new column in MySQL

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

how did you populate it?

try a

Code: Select all

desc jobs;
and see what it returns.
croniccoder
Forum Commoner
Posts: 27
Joined: Fri Jul 07, 2006 10:45 am

Post 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'
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

but know how you that inserted the value really was if select from the table you can not?
croniccoder
Forum Commoner
Posts: 27
Joined: Fri Jul 07, 2006 10:45 am

Post 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.
Post Reply