473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Unknown column 'icaodesc' in 'field list'

Greetings all.

I'm getting the following error message...

Unknown column 'icaodesc' in 'field list'

when I try to update a table from a PHP form.

What 'field list' is it referring to? My PHP script or the MySQL
table???

Here is the PHP script I'm using...

<?php

//set up table and database names
$db_name ="xxx";
$table_name ="yyy";

//connect to server and select database
$connection = @mysql_connect("localhost","user_name","password") or
die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//build and issue query
$sql ="UPDATE $table_name SET
icaodesc ='$_POST[task_icaodesc]',
icaosource ='$_POST[task_icaosource]',
icaonote ='$_POST[task_exp_outcome]',
usposition ='$_POST[task_usposition]',
expoutcome ='$_POST[task_exp_outcome]',
usposition ='$_POST[task_usposition]',
usaction ='$_POST[task_usaction]'
WHERE task_id ='$_POST[id]'";

$result = @mysql_query($sql,$connection) or die(mysql_error());
?>

icaodesc was the NAME in the updatable form. task_icaodesc is a
"good" field in the table yyy

Anyone shed any light on this mystery?

Thanks.

Ward
Aug 12 '05 #1
8 11048
On Fri, 12 Aug 2005 16:58:48 -0400, Ward B decided we needed to hear:
Greetings all.

I'm getting the following error message...

Unknown column 'icaodesc' in 'field list'

when I try to update a table from a PHP form.

What 'field list' is it referring to? My PHP script or the MySQL
table???


The MySQL table - icaodesc is evidently not a column in the table.

<snip>
--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)

Aug 12 '05 #2
Thanks Dave.

Well, you're right. The column name is "task_icaodesc."

But is the first part of this, icaodesc ='$_POST[task_icaodesc]',
throwing off the system? icaodesc is the NAME in the update form.

<TD><strong>ICAO Description of Task:</strong><BR><textarea
name="$icaodesc" cols="30" rows="5"><? echo "$icaodesc";
?></textarea></TD>

And here is from the PHP script in the "show" page.

$icaodesc =$row['task_icaodesc'];

The show page is where the data is extracted from the db and shown in
the applicable form fields for updating.

Does this help?

In the meantime, I'll try some other combinations.

Thanks.

Ward
On Fri, 12 Aug 2005 18:12:25 +0100, Dave <da**@REMOVEbundook.com>
wrote:
On Fri, 12 Aug 2005 16:58:48 -0400, Ward B decided we needed to hear:
Greetings all.

I'm getting the following error message...

Unknown column 'icaodesc' in 'field list'

when I try to update a table from a PHP form.

What 'field list' is it referring to? My PHP script or the MySQL
table???


The MySQL table - icaodesc is evidently not a column in the table.

<snip>

Aug 12 '05 #3
Dave,

I figured it out and you gave me the motivation to try it out.

I had to change "icaodesc" to the correct column name "task_icaodesc."
I didn't think that's what was being defined here (or I can't describe
it the correct jargon). But thanks for giving me the "kick in the
head" to try it.

Now the problem is....the data isn't transferring over the the script
that does the MySQL update. Oy! It just never ends. I'm sure it's
the _$POST array something or other.

Thanks again.

Ward
On Fri, 12 Aug 2005 18:12:25 +0100, Dave <da**@REMOVEbundook.com>
wrote:
On Fri, 12 Aug 2005 16:58:48 -0400, Ward B decided we needed to hear:
Greetings all.

I'm getting the following error message...

Unknown column 'icaodesc' in 'field list'

when I try to update a table from a PHP form.

What 'field list' is it referring to? My PHP script or the MySQL
table???


The MySQL table - icaodesc is evidently not a column in the table.

<snip>

Aug 12 '05 #4
On Fri, 12 Aug 2005 18:23:37 -0400, Ward B decided we needed to hear:
Thanks Dave.

Well, you're right. The column name is "task_icaodesc."

But is the first part of this, icaodesc ='$_POST[task_icaodesc]',
throwing off the system? icaodesc is the NAME in the update form.
Your assignment in the SQL statement is the wrong way around in this
case. Your SQL statement should instead contain:

task_icaodesc = '$_POST[icaodesc]'

that assigns the value of the form variable icaodesc to the column
task_icaodesc in the database. BTW, hopefully you are validating the
value of your form variables before you update your database? - if not
you are wide open for all sorts of problems.

<TD><strong>ICAO Description of Task:</strong><BR><textarea
name="$icaodesc" cols="30" rows="5"><? echo "$icaodesc";
^^^^^^ typo? Its not a good idea for the form field name to
contain a $ sign. The field must be called icaodesc, if you are
going to refer to it in your script as $_POST[icaodesc]
?></textarea></TD>

<snip>

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)

Aug 13 '05 #5
"Ward B" <Wa*******@hotmail.com> kirjoitti
viestissä:t5********************************@4ax.c om...
Dave,

I figured it out and you gave me the motivation to try it out.

I had to change "icaodesc" to the correct column name "task_icaodesc."
I didn't think that's what was being defined here (or I can't describe
it the correct jargon). But thanks for giving me the "kick in the
head" to try it.

Now the problem is....the data isn't transferring over the the script
that does the MySQL update. Oy! It just never ends. I'm sure it's
the _$POST array something or other.

Vell, you can test what data has been sent to the script by dumping all of
it.
<?php
var_dump($_REQUEST);
var_dump($_GET);
var_dump($_POST);
?>

See what they contain...

--
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>
Kimmo Laine <et****************@5P4Mgmail.com>
Aug 13 '05 #6
Good afternoon Dave.

You are all correct and after some experimenting yesterday, I proved
you correct.

The textbook I was using had the $ in the name. That was throwing the
system. So I did exactly as you suggested and everything worked.

Thank you for the help.

Oh BTW, I will have validation before it goes live. <g>

Ward

On Fri, 12 Aug 2005 22:40:49 +0100, Dave <da**@REMOVEbundook.com>
wrote:
On Fri, 12 Aug 2005 18:23:37 -0400, Ward B decided we needed to hear:
Thanks Dave.

Well, you're right. The column name is "task_icaodesc."

But is the first part of this, icaodesc ='$_POST[task_icaodesc]',
throwing off the system? icaodesc is the NAME in the update form.


Your assignment in the SQL statement is the wrong way around in this
case. Your SQL statement should instead contain:

task_icaodesc = '$_POST[icaodesc]'

that assigns the value of the form variable icaodesc to the column
task_icaodesc in the database. BTW, hopefully you are validating the
value of your form variables before you update your database? - if not
you are wide open for all sorts of problems.

<TD><strong>ICAO Description of Task:</strong><BR><textarea
name="$icaodesc" cols="30" rows="5"><? echo "$icaodesc";


^^^^^^ typo? Its not a good idea for the form field name to
contain a $ sign. The field must be called icaodesc, if you are
going to refer to it in your script as $_POST[icaodesc]
?></textarea></TD>

<snip>

Aug 13 '05 #7
Well that's interesting Kimmo.

I'll try that out.

BTW, I did figure out why it isn't working...had to do with using the
$ in the NAME.

Thanks.

Ward
On Sat, 13 Aug 2005 17:11:08 +0300, "Kimmo Laine"
<et*******************@Mgmail.com> wrote:
"Ward B" <Wa*******@hotmail.com> kirjoitti
viestissä:t5********************************@4ax. com...
Dave,

I figured it out and you gave me the motivation to try it out.

I had to change "icaodesc" to the correct column name "task_icaodesc."
I didn't think that's what was being defined here (or I can't describe
it the correct jargon). But thanks for giving me the "kick in the
head" to try it.

Now the problem is....the data isn't transferring over the the script
that does the MySQL update. Oy! It just never ends. I'm sure it's
the _$POST array something or other.

Vell, you can test what data has been sent to the script by dumping all of
it.
<?php
var_dump($_REQUEST);
var_dump($_GET);
var_dump($_POST);
?>

See what they contain...

Aug 13 '05 #8
Dave wrote:
On Fri, 12 Aug 2005 18:23:37 -0400, Ward B decided we needed to hear:

Thanks Dave.

Well, you're right. The column name is "task_icaodesc."

But is the first part of this, icaodesc ='$_POST[task_icaodesc]',
throwing off the system? icaodesc is the NAME in the update form.

Your assignment in the SQL statement is the wrong way around in this
case. Your SQL statement should instead contain:

task_icaodesc = '$_POST[icaodesc]'

that assigns the value of the form variable icaodesc to the column
task_icaodesc in the database. BTW, hopefully you are validating the
value of your form variables before you update your database? - if not
you are wide open for all sorts of problems.

<TD><strong>ICAO Description of Task:</strong><BR><textarea
name="$icaodesc" cols="30" rows="5"><? echo "$icaodesc";

^^^^^^ typo? Its not a good idea for the form field name to
contain a $ sign. The field must be called icaodesc, if you are
going to refer to it in your script as $_POST[icaodesc]

?></textarea></TD>


<snip>


I think that should be:

task_icaodesc = "'" . $_POST['icaodesc'] . "'"; // or
task_icaodesc = "'{$_POST['icaodesc']}'";

The provided code will just put the characters '$_POST[icaodesc]' in the database.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ndsoumah | last post by:
Hello Guys I'm trying to run this query $uneRequete = "SELECT * FROM Usager WHERE motDePasse = {$loginPassword}"; and I get this error message : Error 1054: Unknown column 'xxxx' in WHERE...
2
by: Nospam | last post by:
I installed a script that is suppose to accept paypal, however on trying to test a payment, I get this error msg: Error Database access error and I get this error msg emailed to me:
8
by: phillip.s.powell | last post by:
This query produces the following error: I'm sorry but I must have this "column" in the query, it's vital for required sorting order (you have to sort image_location_country in alphanumeric...
2
by: torpecool | last post by:
Hello Everyone, I just ran into this issue, and I am hoping that some of you may be able to help. I am developing a web-based PHP application with a MySQL back-end. I have a testing and a...
5
by: Larry in Honolulu | last post by:
I'm getting an error message that makes no sense to me. I have a table with a field named 'testkey' for a list of "keys" in the form of ABC10102. I have a php variable holding a specific key...
4
by: karthikeyanck | last post by:
I'm a newbie, I've installed PHP, Apache and MySQL on my Ubuntu system I've trouble in quering the data from MySQL when using the query function within PHP. I 've created a Database "test",...
4
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
3
nomad
by: nomad | last post by:
Hello everyone: I new to PHP and I'm reading a book on PHP Bibles 2nd edition. It has to deal with a user-rating system. There are 4 scripts to it. I'm getting an error Unknown column...
1
by: hannoudw | last post by:
Hi I have a table that contains all the informations about the user . i want to when to click edit to edit the information of a user . I wrote this page : edit_user.php <?php...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.