Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Unknown column 'specificevent' in 'field list'
Old 06-08-2011, 06:59 PM Unknown column 'specificevent' in 'field list'
Novice Talker

Posts: 6
Trades: 0
After I added a new value I just got this error message: Unknown column 'specificevent' in 'field list'

$query = "INSERT INTO milleniumemails (firstname, lastname, fulladdress, telephone, dateofbirth, email, dateadded, specificevent) VALUES ('$firstname', '$lastname', '$fulladdress', '$telephone', '$dateofbirth', '$email', '$dateadded', '$specificevent')";
hyphen4 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-08-2011, 07:53 PM Re: Unknown column 'specificevent' in 'field list'
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Is there a specificevent column in the table? You can't just add a value to the insert query, there has to be a corresponding column in the table as well.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-08-2011, 07:55 PM Re: Unknown column 'specificevent' in 'field list'
Novice Talker

Posts: 6
Trades: 0
Yes there is that field in the database. All of a sudden it won't add anymore entries to the database.
hyphen4 is offline
Reply With Quote
View Public Profile
 
Old 06-08-2011, 08:03 PM Re: Unknown column 'specificevent' in 'field list'
Novice Talker

Posts: 6
Trades: 0
This is the SQL code for the database I have:

CREATE TABLE IF NOT EXISTS `milleniumemails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`fulladdress` varchar(255) NOT NULL,
`telephone` varchar(255) NOT NULL,
`dateofbirth` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`dateadded` varchar(255) NOT NULL,
`specificevent` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=101 ;
hyphen4 is offline
Reply With Quote
View Public Profile
 
Old 06-08-2011, 08:07 PM Re: Unknown column 'specificevent' in 'field list'
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Are you sure the table schema was updated correctly after you added the column? What do you get when you run
Code:
describe milleniumemails;
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-08-2011, 08:16 PM Re: Unknown column 'specificevent' in 'field list'
Novice Talker

Posts: 6
Trades: 0
It displays all my columns:

id int(11) NO PRI NULL auto_increment firstname varchar(255) NO NULL lastname varchar(255) NO NULL fulladdress varchar(255) NO NULL telephone varchar(255) NO NULL dateofbirth varchar(255) NO NULL email varchar(255) NO NULL dateadded varchar(255) NO NULL specificevent text NO NULL
hyphen4 is offline
Reply With Quote
View Public Profile
 
Old 06-08-2011, 08:34 PM Re: Unknown column 'specificevent' in 'field list'
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
I just ran both your create table and insert queries; no error message. Can you post more of your PHP code?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-08-2011, 08:51 PM Re: Unknown column 'specificevent' in 'field list'
Novice Talker

Posts: 6
Trades: 0
It is weird. It just happened a few days ago when I realized when entries weren't being added to the database. And the thing is I never made any changes.

$link = mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');

$query = "INSERT INTO milleniumemails (firstname, lastname, fulladdress, telephone, dateofbirth, email, dateadded, specificevent) VALUES ('$firstname', '$lastname', '$fulladdress', '$telephone', '$dateofbirth', '$email', '$dateadded', '$specificevent')";

mysql_query($query);

The data comes from a form via POST:

$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$dateofbirth = $_POST['dateofbirth'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$specificevent = $_POST['specificevent'];

I used echo(mysql_error()); to get the error message - Unknown column and its still there for me at least. I wonder if its my host. HostGator.com I'm using.
hyphen4 is offline
Reply With Quote
View Public Profile
 
Old 06-08-2011, 09:29 PM Re: Unknown column 'specificevent' in 'field list'
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Try escaping the values beforehand because a single quote could break it.

ex: $specificevent = mysql_real_escape_string($_POST['specificevent']);
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-08-2011, 09:32 PM Re: Unknown column 'specificevent' in 'field list'
Novice Talker

Posts: 6
Trades: 0
Quote:
Originally Posted by mgraphic View Post
Try escaping the values beforehand because a single quote could break it.

ex: $specificevent = mysql_real_escape_string($_POST['specificevent']);
That made no difference. It has to do with adding the information to the database. I'm getting the values from the POST.
hyphen4 is offline
Reply With Quote
View Public Profile
 
Old 06-08-2011, 10:08 PM Re: Unknown column 'specificevent' in 'field list'
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
I don't know what then. Maybe do a repair on the table if the table may have gotten corrupted from the file end.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Unknown column 'specificevent' in 'field list'
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.12912 seconds with 12 queries