472,780 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 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 11010
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.